[Stackless] An idea for making Stackless more naturally usable

Richard Tew richard.m.tew at gmail.com
Tue Sep 5 23:04:31 CEST 2006


On 9/5/06, Andrew Dalke <dalke at dalkescientific.com> wrote:
> BTW, does Stackless work well with OS threads?  What caveats
> are there?  The readme (in Stackless/readme.txt, dated
>   "A small update as of 2006-03-01" says "supporting both
> cooperative switching and stack switching, with the addition
> of partially complete support for real OS threads as a tasklet."
> but that's all I could find.

I have no idea what Christian means by that, and I haven't
seen anything in the Stackless source code which would
give me a hint.

Also not having much experience with threading, I do not
know if by "OS threads" you mean the threading.Thread
threads.

In any case, while I believed that Stackless supported
an isolated scheduler per thread, I did not care to go out on
a limb and say as much, so I wrote up an example to
demonstrate that this does work:

http://svn.python.org/view/stackless/sandbox/examples/threadscheduling.py?view=markup

Also, I started the monkeypatching module based on your
outline:

http://svn.python.org/view/stackless/sandbox/libraries/slpmonkeypatch/

I was a little wary of branching the "stacklesssocket" module
and having two copies.  Perhaps the best solution
would just be to move it into the slpmonkeypatch module
and to delete it as an example.  Then the other examples
which use it can require the monkeypatching be in place.

I think that a tasklet sleep function would also be good to
monkeypatch in as part of the library, perhaps to
stackless.sleep.

Richard.

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



More information about the Stackless mailing list