[Stackless] Why can't I use nanosleep() to suspend the execution of a stackless tasklet?

Bin Huang bin.arthur at gmail.com
Wed Sep 18 17:51:02 CEST 2013

Hi list,

I am working on a project that is based on stackless Python. I tried to
suspend the execution of a stackless tasklet from a Python C module
extension by calling nanosleep(). The Python C module that calls
nanosleep() is embedded inside the tasklet handler. However, my approach
does not work as I expected. It seems that the entire stackless interpreter
is suspended. And all tasklets had to delay (instead of sleeping) for the
interval time I assigned to nanosleep(). (I tried up to 10 second interval
so I could clearly see it).

I also tried using sleep() in the Python C module extension and I observed
the same phenomenon.

I know I could use stackless.schedule() to suspend a tasklet. But I am
still interested in why nanosleep() did not work in my experiment. Is it
because nanosleep() suspend the execution of the stackless scheduler?

I can post my source code if needed. Thanks in advance.

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

More information about the Stackless mailing list