[Stackless] stackless and system threads

Andrew Dalke dalke at dalkescientific.com
Sun Feb 4 05:31:35 CET 2007

On Feb 3, 2007, at 1:38 PM, Richard Tew wrote:
> It really should be documented explicitly that the scheduler will
> exit if there are no tasklets running, which does not include
> those blocked on channels.  Or not running in other forms.

What states are there?  The ones I could think of are:
   - running
   - blocked on send/receive
   - created but not yet started
   - completed but not yet gc'ed (not sure about this one)

> I think people should be disuaded from treating the watchdog as
> something that just runs until all tasklets are exhausted.  The
> model we use at CCP where the watchdog is repeatedly run
> and all tasklets are yielded out of it, to be readded in the next
> run, feels right to me.  And if I were writing documentation about
> Stackless I would explicitly discourage ever using the watchdog
> by itself outside of some form of loop.

I don't understand what you mean by "watchdog."  There is
a reference to that in help(stackless) of

         run_watchdog(timeout) -- run tasklets until they are all
         done, or timeout instructions have passed. Tasklets must
         provide cooperative schedule() calls.
         If the timeout is met, the function returns.

which implies there was a renaming of "run_watchdog" to "run",
while the docstring wasn't changed.  Is this what you mean?

Searching for "watchdog" on stackless.com I found:
> the watchdog was written for CCPgames, who needed this

but nothing which explains that term to a relative outsider
like me.

Could you elaborate a bit about this and explain (hopefully
flavored with a bit of code) what you feel is the right
way to use stackless?

					dalke at dalkescientific.com

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list