[Bf-python] Blender Python & Threading?

Martin Poirier theeth at yahoo.com
Tue Jun 16 21:50:24 CEST 2009




--- On Tue, 6/16/09, Toni Alatalo <antont at kyperjokki.fi> wrote:

> From: Toni Alatalo <antont at kyperjokki.fi>
> Subject: Re: [Bf-python] Blender Python & Threading?
> To: "Blender Foundation Python list" <bf-python at blender.org>
> Received: Tuesday, June 16, 2009, 3:43 PM
> On Jun 16, 2009, at 10:23 PM, joe
> wrote:
> 
> > Ok, so technically it's normal threads, that are
> serialized via the
> > GIL.  That's just semantics though :)
> 
> well on a single core machine they work like normal
> threads, are not 
> 'serialized' in that sense.

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 drop to a Py/C module that releases the GIL (the C code then runs in parallel to other Python code).

Martin


      __________________________________________________________________
The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/



More information about the Bf-python mailing list