[Stackless] Stackless Twisted Reactors Re: Questions about Tasklets and Callbacks

Andrew Francis andrewfr_ice at yahoo.com
Tue Apr 10 13:39:04 CEST 2007


Hello Christian and Christopher:

Christian wrote:

> There is always one and only one tasklet running.
> The only running tasklet is always found as
> stackless.current. It does not matter which function
>of a callback or whatever is running. There is no
>relationship between functions and tasklet 

...

Christopher wrote:

> 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.

Thanks for the answers. I am still munching on the
answer but I believe I get the gist of it. What I
wanted to establish is whether it is safe to make
channel calls from from a callback (after all it seems
to work). 

A problem I constantly run into is that I seem to
loose deferreds. The deferred is called (say
client.getPage) but the underlying network call is
never made. So the deferred never fires. I thought I
licked this problem by using a thread. Again, I spoke
too soon. To make matters worse, I have a hard time
reproducing the error.

Also from reading the Twisted and Stackless mailing
list, it seems the consensus is there shouldn't be a
need to use an additional thread. My personal
experiences say otherwise. However I see that there
are different types of Twisted Reactor. Why not a
Stackless Reactor? I have started looking into writing
a Stackless Reactor that simply calls
stackless.schedule() in its MainLoop()/run() method.

Cheers,
Andrew








 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/

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



More information about the Stackless mailing list