chad at idrankwhat.net
Mon Nov 15 17:49:13 EST 2004
I've run into a problem that requires some form of blocking. I've got a
method that's compiled from a cheetah template and that gets called as the
result of a reactor callback. The cheetah method needs to be able to make
a PB call to fetch some data and block until the results arrive.
Something like this:
def lookup(self, whatToLookup):
pbDeferred = self.pbCall(whatToLookup)
# Some way to block until results are gotten
"cheetahCompiledMethod", itself, cannot use callbacks. The call to
"lookup" can't be done before "cheetahCompiledMethod" is called since it
is unknown at that time what "cheetahCompiledMethod" will require. I was
looking over Christopher Armstrong's gthreadless.py
(http://radix.twistedmatrix.com/archives/000099.html) and it looks
promising, but I am a little concerned about the stability of greenlets.
I also noticed twisted.trial.util.wait. What is the best way to handle
situations like this when they come up?
More information about the Twisted-Python