class documentation

class twisted._threads.ThreadWorker: (source)

Implements interfaces: twisted._threads._ithreads.IExclusiveWorker

View In Hierarchy

An IExclusiveWorker implemented based on a single thread and a queue.

This worker ensures exclusivity (i.e. it is an IExclusiveWorker and not an IWorker) by performing all of the work passed to do on the same thread.

Method __init__ Create a ThreadWorker with a function to start a thread and a queue to use to communicate with that thread.
Method do Perform the given task on the thread owned by this ThreadWorker.
Method quit Reject all future work and stop the thread started by __init__.
Instance Variable _q Undocumented
Instance Variable _hasQuit Undocumented
def __init__(self, startThread, queue): (source)

Create a ThreadWorker with a function to start a thread and a queue to use to communicate with that thread.

ParametersstartThreada callable that takes a callable to run in another thread. (type: callable taking a 0-argument callable and returning nothing.)
queueA Queue to use to give tasks to the thread created by startThread. (type: Queue)

Undocumented

_hasQuit = (source)

Undocumented

def do(self, task): (source)

Perform the given task on the thread owned by this ThreadWorker.

Parameterstaskthe function to call on a thread.
def quit(self): (source)

Reject all future work and stop the thread started by __init__.

API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.