Home | Trees | Index | Help |
|
---|
Package twisted :: Package python :: Module threadpool :: Class ThreadPool |
|
This class (hopefully) generalizes the functionality of a pool of threads to which work can be dispatched.
dispatch(), dispatchWithCallback() and stop() should only be called from a single thread, unless you make a subclass where stop() and _startSomeWorkers() are synchronized.Method Summary | |
---|---|
Create a new threadpool. | |
__getstate__(self)
| |
__setstate__(self,
state)
| |
_runWithCallback(self,
callback,
errback,
func,
args,
kwargs)
| |
_startSomeWorkers(self)
| |
_worker(self,
o)
| |
adjustPoolsize(self,
minthreads,
maxthreads)
| |
callInThread(self,
func,
*args,
**kw)
| |
Dispatch a function to be a run in a thread. | |
Dispatch a function, returning the result to a callback function. | |
dumpStats(self)
| |
Start the threadpool. | |
startAWorker(self)
| |
Shutdown the threads in the threadpool. | |
stopAWorker(self)
|
Class Variable Summary | |
---|---|
int |
_ThreadPool__inited = 0 |
int |
joined = 0 |
int |
max = 20 |
int |
min = 5 |
int |
started = 0 |
int |
workers = 0 |
Method Details |
---|
__init__(self,
minthreads=5,
maxthreads=20)
Create a new threadpool.
|
dispatch(self, owner, func, *args, **kw)Dispatch a function to be a run in a thread. |
dispatchWithCallback(self, owner, callback, errback, func, *args, **kw)Dispatch a function, returning the result to a callback function. The callback function will be called in the thread - make sure it is thread-safe. |
start(self)Start the threadpool. |
stop(self)Shutdown the threads in the threadpool. |
Class Variable Details |
---|
_ThreadPool__inited
|
joined
|
max
|
min
|
started
|
workers
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Sat May 15 20:07:44 2004 | http://epydoc.sf.net |