[Stackless] Explicit yield/break to Preemptive Stackless Loop

Brian Hardie bhardie at cs.usfca.edu
Wed Nov 1 20:10:22 CET 2006

I am using Stackless preemptive scheduling with a single tasklet in  
order to periodically break out of the code and check for some  
special conditions.  This seems to be working perfectly well.   
However, I have recently come across the need to have the tasklet  
explicitly yield back out to the main 'stackless loop' before the  
quantum has expired in order to check some conditions and potentially  
do some work.

stackless.schedule() and stackless.schedule_remove() do a fine job of  
yielding to the next tasklet, but it seems, in my situation of having  
only a single tasklet, that it does not cause a breakout of the  
'Stackless loop'.

Below is the 'Stackless loop' that I refer to.  Is this kind of  
'yield' or 'break' functionality built into Stackless?  If it isn't,  
I'm willing to add the functionality to the c code, but could use  
some pointers on where and how to get started.

		while stackless.getruncount() > 1:
			t = stackless.run(QUANTUM)
			if t:

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list