Implements interfaces: IWorker

I implement an IWorker that runs tasks in a dedicated worker thread.

ParametersseriesA list of one or more task series that this particular instance of me is qualified to handle.
rawSet True if you want raw iterators to be returned instead of iteration.Deferator instances. You can override this in with the same keyword set False in a call.
Class Variable cQualified A task series that all instances of me are qualified to perform.
Instance Variable iQualified A task series that this instance of me is qualified to perform. Usually left blank, unless you want only some workers doing certain tasks.
Instance Variable tasks A list of pending tasks.
Instance Variable t An instance of ThreadLooper.
Method __init__ ThreadWorker(series=[], raw=False)
Method setResignator Undocumented
Method run Returns a Deferred that fires only after the threaded call is done for the supplied task.
Method stop Returns a Deferred that fires when all pending tasks have been run, the task loop has ended and its thread has terminated.
Method crash Since a thread can only terminate itself, calling this method only forces firing of the deferred returned from a previous call to stop and returns the task that hung the thread.
cQualified =
A task series that all instances of me are qualified to perform.
iQualified =
A task series that this instance of me is qualified to perform. Usually left blank, unless you want only some workers doing certain tasks.
tasks =
A list of pending tasks.
t =
An instance of ThreadLooper.
def __init__(self, series=[], raw=False):

ThreadWorker(series=[], raw=False)

def setResignator(self, callableObject):
Undocumented
def run(self, task):

Returns a Deferred that fires only after the threaded call is done for the supplied task.

I do basic FIFO queuing of calls to this method, but priority queuing is above my paygrade and you'd best honor my deferred and let someone like tasks.TaskHandler only call this method when I say I'm ready.

One simple thing I will do is apply the doNext keyword to any task with the highest priority, -20 or lower (for a base.TaskQueue.call with its own doNext keyword set). If you call this method one task at a time like you're supposed to, even that won't make a difference, except that it will cut in front of any existing call with doNext set. So use judiciously.

def stop(self):

Returns a Deferred that fires when all pending tasks have been run, the task loop has ended and its thread has terminated.

Waits for all pending tasks to finish because they run in the task loop and can't do so once the task loop has ended. So the list of outstanding tasks that is the deferred result should always be empty.

def crash(self):

Since a thread can only terminate itself, calling this method only forces firing of the deferred returned from a previous call to stop and returns the task that hung the thread.

API Documentation for AsynQueue, generated by pydoctor at 2022-11-17 13:13:24.