[Stackless] Proposed modification WRT threading and scheduling

Richard Tew richard.m.tew at gmail.com
Wed Jan 9 09:25:33 CET 2008


Hi,

As I don't normally use Python threads with Stackless, I wasn't
totally familar with how they worked together.  I assumed that since
each thread can run a scheduler, the threads would then just schedule
away independently.  However, this is not the case.

When the scheduler is run, when there are no remaining tasklets
scheduled and there are other Python threads which are runnable, then
the scheduler will not exit and will instead block indefinitely
waiting for one of those threads to reawaken it.  You can see this
demonstrated in the attached script, where the main thread will block
instead of exiting the scheduler.

I'd like to make a change to Stackless to optionally disable this
behaviour, perhaps an option which can be set on the stackless module,
or a parameter to the 'stackless.run' function.

Any thoughts?  Comments?

Cheers,
Richard.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threadsched.py
Type: text/x-python
Size: 930 bytes
Desc: not available
URL: <http://www.stackless.com/pipermail/stackless/attachments/20080109/bb0eb4d2/attachment.py>


More information about the Stackless mailing list