Table of Contents

Class: ThreadDispatcher | Twisted-0.17.4/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 main from twisted.internet import threadtask tpool = ThreadDispatcher() main.callDuringShutdown(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 Sat Apr 20 01:30:49 2002 by HappyDoc version 2.0