interface documentation

class IWorker(Interface): (source)

Known subclasses: twisted._threads._ithreads.IExclusiveWorker

Known implementations: twisted._threads.Team

View In Hierarchy

A worker that can perform some work concurrently.

All methods on this interface must be thread-safe.

Method do Perform the given task.
Method quit Free any resources associated with this IWorker and cause it to reject all future work.
def do(task: Callable[[], None]): (source)

Perform the given task.

As an interface, this method makes no specific claims about concurrent execution. An IWorker's do implementation may defer execution for later on the same thread, immediately on a different thread, or some combination of the two. It is valid for a do method to schedule task in such a way that it may never be executed.

It is important for some implementations to provide specific properties with respect to where task is executed, of course, and client code may rely on a more specific implementation of do than IWorker.

Parameters
task:0-argument callablea task to call in a thread or other concurrent context.
Raises
AlreadyQuitif quit has been called.
def quit(): (source)

Free any resources associated with this IWorker and cause it to reject all future work.

Raises
AlreadyQuitif this method has already been called.