[Stackless] Proposed modification WRT threading and scheduling

Richard Tew richard.m.tew at gmail.com
Wed Jan 9 20:31:06 CET 2008


On Jan 9, 2008 11:02 PM, Arnar Birgisson <arnarbi at gmail.com> wrote:
> On Jan 9, 2008 8:25 AM, Richard Tew <richard.m.tew at gmail.com> wrote:
> > 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.
>
> What do you mean by "disable this behaviour"? Would you make the
> scheduler with no runnable tasklets busy-loop to poll for tasklets? If
> so, the parameter you mention could be an integer, saying how many
> milliseconds to sleep between polls, with the default value of 0
> giving you the current blocking behaviour.

As I understand it, this would make no difference.  The tasklets would
have to be awakened by channel activity on the other threads.  This
will already cause the main thread to awaken.

> Or perhaps you have something different in mind?

Yes.  I would just have the scheduler exit when there are no runnable
tasklets left within it, regardless of the existence of other Python
threads.  Any parameter or setting would be boolean.  By default False
indicating that it should block for the other threads and True that it
should retrieve the main tasklet and exit the scheduler.

Richard.




More information about the Stackless mailing list