[Twisted-Python] Stackless/Twisted integration again

Simon Pickles sipickles at hotmail.com
Sun Apr 6 03:39:08 MDT 2008


I was interested in Andrews Paper on this subject. I note he recommends 
running a twisted server as a tasklet.

Is there a problem doing this?

factory = pb.PBClientFactory
reactor.connectTCP('127.0.0.1', 1234, Factory)
# Load other tasklets here
stackless.tasklet(reactor.iterate)(1)

or should I perhaps do this?

factory = pb.PBClientFactory
reactor.connectTCP('127.0.0.1', 1234, Factory)
# Load other tasklets here
while 1:
    stackless.tasklet(reactor.iterate)(1)
    stackless.schedule()

What does the delay in reactor.iterate(delay=0) do? Is there a 
reactor.run_once() call?

I want to make the reactor a tasklet so it is included in the scheduler. 
Seems to be working but have I opened a can of worms?

Thanks

Simon

-- 
Linux user #458601 - http://counter.li.org.







More information about the Twisted-Python mailing list