Home | Trees | Index | Help |
---|
Package twisted :: Package internet :: Module threadtask :: Class ThreadDispatcher |
|
ThreadPool
--+
|
ThreadDispatcher
A thread pool that is integrated with the Twisted event loop.
The difference from ThreadPool is that callbacks are run in the main IO event loop thread, and are thus inherently thread-safe.
You probably want your instance to be shutdown when Twisted is shut down:from twisted.internet import reactor from twisted.internet import threadtask tpool = ThreadDispatcher() reactor.addSystemEventTrigger('during', 'shutdown', tpool.stop)
Method Summary | |
---|---|
__init__(self,
*args,
**kwargs)
| |
(inherited from ThreadPool )
| |
(inherited from ThreadPool )
| |
Dispatch a function to be a run in a thread. (inherited from ThreadPool )
| |
dispatchApply(self,
owner,
callback,
errback,
func,
args,
kw)
| |
Dispatch a function, returning the result to a callback function. | |
(inherited from ThreadPool )
| |
runInThread(self,
callback,
errback,
func,
*args,
**kw)
| |
Start the threadpool. (inherited from ThreadPool )
| |
Shutdown the threads in the threadpool. | |
_runWithCallback(self,
callback,
errback,
func,
args,
kwargs)
| |
(inherited from ThreadPool )
| |
(inherited from ThreadPool )
|
Method Details |
---|
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 main event loop thread. |
stop(self)Shutdown the threads in the threadpool.
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 1.2 prerelease on Wed Jan 29 06:28:16 2003 | http://epydoc.sf.net |