Package DebTorrent :: Module piecebuffer :: Class BufferPool
[hide private]
[frames] | no frames]

Class BufferPool

source code

The pool of all created piece buffers.

Instance Methods [hide private]
 
__init__(self)
Initialize the instance.
source code
SingleBuffer
new(self)
Get a SingleBuffer from the pool, or create a new one.
source code
 
release(self, x)
Add an existing buffer to the pool of available ones.
source code
Instance Variables [hide private]
int count
the number of created buffers (for debugging)
threading.Lock lock
serializes access to the pool across different threads
list of SingleBuffer pool
the pooled buffers available for use
Method Details [hide private]

new(self)

source code 
Get a SingleBuffer from the pool, or create a new one.
Returns: SingleBuffer
a usable piece buffer

release(self, x)

source code 
Add an existing buffer to the pool of available ones.
Parameters: