Package grassyknoll :: Package concurrent :: Module ThreadPool :: Class ThreadPool
[hide private]

Class ThreadPool

source code


a threadpool with MailBox support

Nested Classes [hide private]
class _workerClass
class of Worker.Worker to create
Instance Methods [hide private]
 
__init__(self, context_factory, inbox=None, num_workers=1, name=None, **kwargs)
Other arguments are passed _WorkerClass
source code
 
__repr__(self)
repr(x)
source code
 
start(self)
Start the ThreadPool
source code
integer
aliveCount(self)
Returns: number of workers still alive
source code
 
stop(self)
Shutdown the threadpool and close its inbox, preventing future messages
source code
 
join(self, timeout=None)
block until the pool terminates.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Methods [hide private]

Inherited from lib.meta.FactoryMixin: factory

Class Variables [hide private]
  logger = AutoLogger()
Instance Variables [hide private]
MailBox.ThreadMailBox inbox
a shared inbox for the pool
string name
name of the threadpool.
set workers
the pool's Worker.Workers
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, context_factory, inbox=None, num_workers=1, name=None, **kwargs)
(Constructor)

source code 
Other arguments are passed _WorkerClass
Parameters:
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 
repr(x)
Overrides: object.__repr__
(inherited documentation)

aliveCount(self)

source code 
Returns: integer
number of workers still alive

join(self, timeout=None)

source code 

block until the pool terminates.

This function has the same behavior as threading.Thread.join, see its documentation. In particular, this function always returns None, so you should use aliveCount to see if the pool has terminated.

Instance Variable Details [hide private]

name

name of the threadpool. This is used for mailboxes, etc.
Type:
string