[Stackless] Stackless / Networking

ghazel at gmail.com ghazel at gmail.com
Wed Feb 21 02:18:29 CET 2007

> The problem I see is that the Twisted scheduled task
> (a callback) ought to call schedule() to give other
> tasklets a chance to run. I don't had a good mental
> model of what is happening between between Twisted
> callbacks and Stackless tasklets in this scenario.

So you could approach it one of two obvious ways. Either you could
have Twisted periodically call stackless.schedule(), on say a LoopingCall.
This would work if your tasklets need to run every so often - you control
the granularity of how often they run. Otherwise a scheduling Stackless
tasklet could occasionally queue up an event to reschedule (
reactor.callLater(0, stackless.schedule)), and then call schedule() itself
to let other tasklets run. The allows you to control the granularity in a
tasklet instead of time-based.

I use a third mechanism, which is that tasklets use channels to "block"
until a deferred they're waiting on completes - the deferred is given a
callback that sends the result back to the channel then calls

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20070220/5836bbcf/attachment.htm>
-------------- next part --------------
Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list