__init__(self,
callable,
args=None,
kwds=None,
requestID=None,
callback=None,
exc_callback=None)
(Constructor)
Create a work request for a callable and attach callbacks.
A work request consists of the a callable to be executed by a
worker thread, a list of positional arguments, a dictionary
of keyword arguments.
A callback function can be specified, that is called when the results
of the request are picked up from the result queue. It must accept
two arguments, the request object and the results of the callable,
in that order. If you want to pass additional information to the
callback, just stick it on the request object.
You can also give a callback for when an exception occurs. It should
also accept two arguments, the work request and a tuple with the
exception details as returned by sys.exc_info().
requestID, if given, must be hashable since it is used by the
ThreadPool object to store the results of that work request in a
dictionary. It defaults to the return value of id(self).
-
|