Table of Contents

Class: ThreadDispatcher Twisted-0.19.0/twisted/internet/threadtask.py

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)

Base Classes   
threadpool.ThreadPool
Methods   
__init__
_runWithCallback
dispatchApply
dispatchWithCallback
runInThread
stop
  __init__ 
__init__ (
        self,
        *args,
        *kwargs,
        )

  _runWithCallback 
_runWithCallback (
        self,
        callback,
        errback,
        func,
        args,
        kwargs,
        )

  dispatchApply 
dispatchApply (
        self,
        owner,
        callback,
        errback,
        func,
        args,
        kw,
        )

  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 main event loop thread.

  runInThread 
runInThread (
        self,
        callback,
        errback,
        func,
        *args,
        *kw,
        )

  stop 
stop ( self )


Table of Contents

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