[Bf-python] Blender Python & Threading?

Toni Alatalo antont at kyperjokki.fi
Tue Jun 16 21:57:48 CEST 2009


On Jun 16, 2009, at 10:50 PM, Martin Poirier wrote:

> Joe is right, because of how the GIL works, only one thread can run 
> concurrently in a CPython VM. The only way to run multiple python 
> functions in parallel is to either use multiple processes (there are 
> py modules for that in the std lib IIRC) or

it seemed to me he was not talking about that, but said this instead: 
"I believe you have to explicitly release the GIL (and reacquire it) in 
the main thread for threads to really work at all. " .. and i think my 
test showed that is not true, the thread did work.

just not concurrently, so they only work for making things to not 
block, not for performance gain on multicores - and like said e.g. 
events are usually a better way for the blocking case. or indeed 
greenlets and such, if 'green threads' referred to that.

~Toni




More information about the Bf-python mailing list