[Stackless] Questions about Tasklets and Callbacks

Christopher Armstrong radix at twistedmatrix.com
Tue Apr 10 00:49:14 CEST 2007


On 4/9/07, Andrew Francis <andrewfr_ice at yahoo.com> wrote:
> Hi Colleagues:
>
> I trying to understand how to better integrate Twisted
> with Stackless. I realise that I do not understand
> what is happening under the hood in the Stackless
> Python VM.
>
> I have some simple questions. When a callback is
> activated, what is its relationship to Stackless? Is
> it running as a part of the main tasklet? Also is it
> safe for a callback to issue a channel.receive? Under
> what conditions will this fail?

Switches only happen explicitly, so if no switch happens, the code you
are calling is running in the same tasklet. Therefore, whenever a
callback is made (i.e., from a Deferred), the callback will be run in
the same tasklet that the code that is calling the callback is running
in. So, assuming a Deferred 'd' with some callbacks attached to it,
running 'd.callback(result)' in tasklet X calls all of d's callbacks
in tasklet X.


-- 
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list