[Stackless] switching improvements

Christian Tismer tismer at stackless.com
Thu Nov 29 02:24:49 CET 2012


Hi Kristjan,

how about checking it into a branch firt, let us try and check that
intensively, and after enough confidence merge it in?
That's the way that works best for me with Mercurial/Git.

If you don't like to put a branch into python.org, you also can do a clone
on bitbucket easily and let us use that for review.

cheers - chris

On 28.11.12 16:11, Kristján Valur Jónsson wrote:
>
> Hello All.
>
> I was recently prompted to add a flag to stackless, a way to block all 
> tasklet switching.
>
> This springs from the way that we are embedding stackless python in an 
> game engine (UnReal) which sometimes makes callbacks into python. 
> Sometimes, this code will do nasty stuff that results in tasks 
> switching, causing havoc with the control flow of the game engine.
>
> To simplify this, I added a per-thread flag, switch_trap, which can be 
> controlled in a similar way to block_trap.  If the logic causes a 
> switch to be attempted, this should be trappable and the code should 
> be easily fixable, or we can otherwise deal with it.
>
> Anyway, doing this, adding it to slp_schedule_task(), and so on, 
> uncovered a subtle flaw in stackless:
>
> It turns out that slp_schedule_task() had no way of differentiating 
> whether an exception result from this call came as a result of a 
> failure to switch, or an exception being sent to the tasklet when it 
> wakes up again.
>
> So, I have changed the interface to be able to do this properly.  
> There are other reasons why switching can fail, including memory 
> allocation failures and so on, so this seems like a necessary change. 
> I also fixed code both in stacklesseval.c and taskletmodule and 
> channelobject to be able to cope with switch failure like this.
>
> Now:
>
> How does this sound to you?  The change is somewhat large and I would 
> hesitate to simply check it in without some sort of review or 
> otherwise approval.  Any suggestions?
>
> K
>
>
>
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless


-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Software Consulting          :     Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121     :    *Starship* http://starship.python.net/
14482 Potsdam                :     PGP key -> http://pgp.uni-mainz.de
phone +49 173 24 18 776  fax +49 (30) 700143-0023
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20121129/f4ffdb60/attachment.html>


More information about the Stackless mailing list