Trees | Index | Help |
|
---|
Package pyAA :: Module Defer :: Class Deferred |
|
object
--+
|
Deferred
A placeholder for a result to be returned at a later time. An object can add handlers to this object that will be called in the order added when the result is ready.
Instances of this object are thread safe.Method Summary | |
---|---|
Initialize an instance. | |
Add a callback to this deferred object. | |
Called when the result is ready. | |
boolean |
Return is the result ready? |
Inform all listeners of the result. | |
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
Instance Variable Summary | |
---|---|
Queue.Queue | callbacks : Queue of callbacks the make when the result is ready |
boolean | called : Is the result ready? |
threading.Lock | lock : Prevents reentry while making callbacks |
threading.Lock | put_lock : Prevents new callbacks from being added while servicing a callback |
list | result : Result to be returned to listeners |
Method Details |
---|
__init__(self)
Initialize an instance.
|
AddCallback(self, func, *args, **kwargs)Add a callback to this deferred object. The provided function will be called with a list of positional parameters followed by the positional and keyword arguments given to this method.
|
Callback(self, *args)Called when the result is ready.
|
IsCalled(self)
|
MakeCalls(self)Inform all listeners of the result. Let each listener return its own result to be passed to all listeners further down the chain. Exceptions currently do no propogate. |
Instance Variable Details |
---|
callbacksQueue of callbacks the make when the result is ready
|
calledIs the result ready?
|
lockPrevents reentry while making callbacks
|
put_lockPrevents new callbacks from being added while servicing a callback
|
resultResult to be returned to listeners
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Thu Mar 10 23:08:34 2005 | http://epydoc.sf.net |