Table of Contents

Class: ThreadPool | Twisted-0.19.0/twisted/python/threadpool.py
--- | ---
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.
Methods |
--- | ---
__getstate__ __init__ __setstate__ _runWithCallback _startSomeWorkers _worker | dispatch dispatchWithCallback dumpStats start stop
| __getstate__
    __getstate__ ( self )
| __init__
    __init__ (
            self,
            minthreads=5,
            maxthreads=20,
            )
| __setstate__
    __setstate__ ( self,  state )
| _runWithCallback
    _runWithCallback (
            self,
            callback,
            errback,
            func,
            args,
            kwargs,
            )
| _startSomeWorkers
    _startSomeWorkers ( self )
| _worker
    _worker ( self )
| dispatch
    dispatch (
            self,
            owner,
            func,
            *args,
            *kw,
            )
### Dispatch a function to be a run in a thread. owner must be a loggable object.
| dispatchWithCallback
    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.
| dumpStats
    dumpStats ( self )
| start
    start ( self )
Start the threadpool.
| stop
    stop ( self )
Shutdown the threads in the threadpool.

Table of Contents

This document was automatically generated on Sun Jul 14 19:53:11 2002 by HappyDoc version 2.0