Microthreads without Stackless?

Michael Hobbs michael at hobbshouse.org
Fri Sep 10 20:48:41 CEST 2004


Does anyone know of an existing package that provides microthreads, other
than Stackless Python? I would like to be able to provide microthreads in
my Candygram package, but I'm not interested in Stackless (for various
reasons).

In theory, it should be fairly straightforward to do preemptive
microthreading using a combination of generators and a separate IO thread.
The IO thread would poll for pending IO events and also periodically call
thread.interrupt_main() to preempt the current generator.

The devil, however, is in the scheduler's details. I am therefore hoping
that someone else has already gone through those details and created a
package. Anyone heard of such a thing?

Thanks,
- Mike

P.S. The Candygram package is an implementation of Erlang concurrency
primitives within Python.  http://candygram.sourceforge.net






More information about the Python-list mailing list