[Stackless] Mixing os threads and stackless

Lars Immisch lars at ibp.de
Wed Apr 26 13:58:22 CEST 2006


>>> I don't *think* you'd get much advantage with this as the python 
>>> global interpreter lock will block all threads while another is 
>>> executing so you might as well run a single thread with all your 
>>> tasklets in it?
>> Why would the PGIL block all threads?
> Correct me if I'm wrong but afaik the PGIL only allows one thread to be 
> executing python code ( or C code called from python that hasn't 
> explicitly released the PGIL ) at any one time?

You are correct. The GIL only allows one thread to be executing *python 
code*, in the sense of: interpreting python bytecode, instead of: 
calling a library function that calls out to C underneath (and releases 
the GIL).

But this is a subtle distinction that requires understanding what is 
implemented in terms of C functions and what isn't.

Now, if anyone mixes OS threads and tasklets, s/he should have that 
understanding or go acquire it.

- Lars

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list