[Twisted-Python] reactor.run() do not return after reactor.stop()

Johann Borck johann.borck at densedata.com
Sat Oct 10 12:25:35 MDT 2009


Stanislav Yudin wrote:
> Thanks, but how can I pass control back to calling code after starting 
> the reactor? Or the idea is to run it in separate thread? I understand 
> that main idea on twisted is async processing, but this time I need to 
> block the calling code until response is received.
>
You already have everything set up, make your SimpleClient._on_done 
callback aware of what has to happen next, and if you don't know 
beforehand, maybe because the next thing to do depends on the result of 
the current, you can pass a callable to the code in charge of that 
decision. The only difference is that you have to break the currently 
blocking code into several callables.

hth, Johann




More information about the Twisted-Python mailing list