[PEAK] More event questions
chad at idrankwhat.net
Fri Nov 12 15:11:45 EST 2004
What I've got is a method compiled by a cheetah script. This method is
called as the result of a Twisted callback. The cheetah method needs to
be able to make a PB call to fetch some data and block until the data
arrives. Something like this:
def lookup(self, whatToLookup):
pbDeferred = self.pbCall(whatToLookup)
# Some way to block until results are gotten
"cheetahCompiledMethod", itself, cannot be asynchronous or 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. The reason I kept trying to get runUntil to work is it seemed,
at the time, like a logical choice to block on the PB call in "lookup".
My heart is not set on nested event loops, but I have yet to figure out
a way to get the above to work otherwise. :(
On Fri, 12 Nov 2004, Phillip J. Eby wrote:
> At 03:26 PM 11/11/04 -0800, Chad Rosenberg wrote:
> >Is it safe to use runUntil from a call originating from reactor.callLater?
> Not with the same reactor instance.
> >I thought this would eliminate nested runUntils, but I am still getting
> >Unexpected reactor exits. Any insights?
> Yes. Stop using runUntil(). I haven't seen any examples or explanations
> from you that show you actually need it for anything. 'runUntil()' is
> intended for a top-level event loop. Code that is inside an event loop
> should not use it unless you need a nested event loop. If you can explain
> why you need a nested event loop, I'll help you figure out how to get it
> Most likely, however, whatever you're trying to do will more easily be
> accomplished by yielding to an event, or setting an event callback.
> PEAK mailing list
> PEAK at eby-sarna.com
More information about the PEAK