[pypy-dev] Stacklets

Armin Rigo arigo at tunes.org
Fri Sep 23 22:38:43 CEST 2011


2011/9/23 Александр Седов <elec.lomy.ru at gmail.com>:
> I'm interested in porting _stackless to stacklets (and also probably
> making it inter-thread).

Thanks!  Work in this direction is already well advanced.  More
precisely, the directory pypy/module/_stackless is obsolete and gone,
and the pure Python module lib_pypy/stackless.py has been ported to
use _continuation.  (I wonder somehow why we had all this code in
pypy/module/_stackless that seems not needed any more.)  But it is not
multi-thread-safe so far, which is probably an easy fix, using a
thread-local instead of all these global variables initialized in
_init() in stackless.py.

Note also that there is a branch "continulet-pickle" that could do
with help from someone with more motivation than me to finish this.
So far you can pickle continulets, greenlets, and coroutines, but not
tasklets.  It looks messy because of early-optimization issues from
stackless.py --- e.g. it would be much more natural for it to switch
to the main tasklet every time it needs to do the scheduling and
choose the next tasklet to switch to, instead of being clever and
switching directly to the target tasklet; this "unwanted cleverness"
prevents pickling from working at all, because it sees too much
unrelated stuff in a suspended tasklet.

All in all what I would be most happy with, at this point, is if
someone would step up and finish porting and maintaining stackless.py.
 Ideally it would be someone that needs this code for his own
projects, too.

> Where can I find reference API documentation for channels and tasklets

At the Stackless Python original web site.

A bientôt,


More information about the pypy-dev mailing list