Stackless/microthreads merge news

Will Ware wware at world.std.com
Mon Mar 13 07:03:53 EST 2000


Konrad Hinsen (hinsen at cnrs-orleans.fr) wrote:
> Looks great! One question: are there any provisions to use
> microthreads in C extension modules? If yes, is the Python interpreter
> (the modified one) thread-safe for microthreads, or is there still
> something like the global interpreter lock? Getting rid of that would
> be reason enought to switch to microthreads for me.

Chris wrote all the C code, and he can give better answers. I'm inclined
to say you should be able to do everything in C that the manual shows
being done in Python but of course the syntax would be much uglier. Also,
I'm not 100% certain of that, because running Python code causes a
counter (called uthread_ticker) to count down, and when it hits zero,
a context switch occurs, and to you that appears to be an invisible
background task. So you'd need to explicitly step down that counter and
allow the context switching code to run, and I'm not sure how you'd do
that unless you allowed yourself to return out to the Python world. So
the simplest thing would be to arrange your computation as a bunch of
limited-duration steps, each of which could be a call from Python. That's
probably not what you're looking for, maybe Chris will have a more
satisfactory idea.
-- 
 - - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware	email:    wware @ world.std.com



More information about the Python-list mailing list