Trees | Indices | Help |
|
---|
|
object --+ | threading._Verbose --+ | threading.Thread --+ | TerminatableThread --+ | WorkerThread
This base allows to call functions on class instances natively and retrieve their results asynchronously using a queue. The thread runs forever unless it receives the terminate signal using its task queue.
Tasks could be anything, but should usually be class methods and arguments to allow the following:
inq = Queue() outq = Queue() w = WorkerThread(inq, outq) w.start() inq.put((WorkerThread.<method>, args, kwargs)) res = outq.get()
finally we call quit to terminate asap.
alternatively, you can make a call more intuitively - the output is the output queue allowing you to get the result right away or later w.call(arg, kwarg='value').get()
inq.put(WorkerThread.quit) w.join()
You may provide the following tuples as task: t[0] = class method, function or instance method t[1] = optional, tuple or list of arguments to pass to the routine t[2] = optional, dictionary of keyword arguments to pass to the routine
|
|||
InvalidRoutineError Class sent as return value in case of an error |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from Inherited from Inherited from Inherited from |
|||
Subclass Interface | |||
---|---|---|---|
Inherited from Inherited from |
|||
Interface | |||
|
|||
Inherited from |
|
|||
inq | |||
outq | |||
Inherited from Inherited from Inherited from |
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
|
|
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Apr 19 18:00:19 2011 | http://epydoc.sourceforge.net |