[Twisted-Python] Fast RPC

Pavel Pergamenshchik pp64 at codelock.com
Wed Jul 6 17:33:36 EDT 2005


On Wed, 6 Jul 2005 12:11:43 -0400
William Waites <ww at groovy.net> wrote:

> On Wed, Jul 06, 2005 at 11:51:37AM -0400, Itamar Shtull-Trauring
wrote:
> > On Tue, 2005-07-05 at 23:17 -0400, William Waites wrote:
> > 
> > > > reactor.run(installSignalHandlers=False) may fix that.
> > > 
> > > Hmmm. I tried that, but then the reactor stalls. No
> > > reactor.callLater's actually seem to get called...
> > 
> > That's how it's supposed to work: reactor.run() doesn't exit until
you
> > stop the reactor. You need to setup scheduled calls before running
the
> > reactor.
> 
> I understand that. I had set up a couple of reactor.callLater's
> before calling reactor.run(). They just don't actually seem to
> get run.
> 
> For actual operation, control passes from a thread in the 
> C++ method TelEngine::MessageHandler::received(Message &m)
> to a python function softswitch.message(m) which then calls
> into the reactor using callFromThread. Bit I'm not quite
> there yet, first step was to get the reactor running, which
> seems to work with threadedselectreactor.

Please make sure you understand how to use threadedselectreactor.
Specifically, you should not call run() on it. You are supposed to call
reactor.interleave(func), where func is your waker function. You _must_
do that or threadedselectreactor will not work. See the examples in
Twisted/doc/core/examples/threadedselect.




More information about the Twisted-Python mailing list