Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`_threads`.`ThreadWorker``

class documentation

`class ThreadWorker: (source)`

Constructor: `ThreadWorker(startThread, queue)`

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 | `_hasQuit` | Undocumented
Instance Variable | `_q` | 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.

Parameters
startThread:callable taking a 0-argument callable and returning nothing. | a callable that takes a callable to run in another thread.
queue:`Queue` | A `Queue` to use to give tasks to the thread created by `startThread`.

def do(self, task: `Callable[[], None]`): (source)
from `twisted._threads.IWorker`

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

Parameters
task:`Callable[[], None]` | the function to call on a thread.

def quit(self): (source)
from `twisted._threads.IWorker`

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

_hasQuit = (source)

Undocumented

_q = (source)

Undocumented