[Stackless] stacklesslib & tealet
Kristján Valur Jónsson
kristjan at ccpgames.com
Wed Apr 17 16:57:45 CEST 2013
I've been working on stacklesslib for a bit now after PyCon.
I´ve restructured it a bit and fixed it in many places.
it now contains an "app" submodule which stackless aware applications should use to get stuff such as "sleep" and "Event". The reason for this is that some modules may run either as standalone vanilla thingies, or co-operatively in stackless mode. If we don't want to monkeypatch the whole environment (not alwasy a nice thing to do) then using the appropriate stuff from "app" is a good thing.
The EventLoop has been moved into its own submodule and given an interface similar to the relevant parts of Guido's "tulip" project.
There is a new and powerful feature in "util" called "timeout" which allows the timing out of arbitrary callstacks.
A bunch of problems in the asyncore/socket implementation were ironed out.
Check it out at https://bitbucket.org/krisvale/stacklesslib
Then there is the tealet lib.
This is code from Armin Rigo, basically a further factoring out from greenlets. It is a pure C library that implements stack slicing without any reference to Python at all. Use this to bring the magic of stack slicing to your stack based program.
I have been tinkering with Armin's code for some two years now. I added some robustness features (error handling) and optimized the stack handling in various ways. Tealets can now be duplicated and this used to create 'stub' tealets for spawning new ones, rather than always spawning a new tealet off from the current stack position.
There is also a pytealet module that provides a (2.7) extension module, and a greenlet.py emulation module that re-implements greenlets on top of tealets.
Check it out at https://bitbucket.org/krisvale/tealet (I´ve forked this out of my "public" repo, go to krisvale/public for the full revision history)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Stackless