[Stackless] Issues with tasklet shutdown

Lloyd Weehuizen lloyd at fusion.net.nz
Fri Sep 1 14:07:47 CEST 2006


I have a scheduler written in python following the standard examples of
a sleep function and a beNice/yield. On application exit I call a
function called KillTasklets that walks any tasklets that are still
blocked on yields or sleep functions and calls kill on them. It works 
without any problems.

I've now tried to convert my scheduler to C++ following the examples in
the stackless repository. Its all working great, except my KillTasklet
function no longer works on some tasklets. This causes the application 
to "hang" on exit as as it gets stuck in PyFinalize. ( I have the latest 
tasklet killing shutdown patch )

An example of one of these tight loops, is a tasklet that simply polls 
the python asynccore

while True:
   asyncore.poll( 0 )
   scheduler.Yield()

If PyErr_Occurred inside the yield function it returns true ( so the 
TaskletExit exception is sitting waiting to be processed ) but I'm 
guessing not enough of the python interpretter is running to actually 
get the exception raised properly?

If I put a "print" in the loop, it all shuts down properly ( am guessing 
the print keyword has enough logic in it to raise exceptions )

Has anybody run into this before? Is there any way I can force the 
exception to be raised?

Thanks,
Lloyd




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



More information about the Stackless mailing list