[Bf-python] Blender Python & Threading?

Florian Lier blender at icram.de
Tue Jun 16 21:42:56 CEST 2009


Hey,

jap - threads are working - but I didn't test them for any
side effects or locks. As Toni said I don't really need them
ATM...(we'll see ^^)

Instead of threads I'm working with events.


10q all. Florian

joe wrote:
> On Tue, Jun 16, 2009 at 1:15 PM, Toni Alatalo<antont at kyperjokki.fi> wrote:
>   
>> On Jun 16, 2009, at 10:03 PM, joe wrote:
>>
>>     
>>> No it's not, python uses "green threads", and it requires additional
>>> support on the py c api side (which none of us have figured out yet,
>>>       
>> huh? i thought it's normal threads.
>>     
>
> Ok, so technically it's normal threads, that are serialized via the
> GIL.  That's just semantics though :)
>
>   
>> you can create them, but don't expect the api to be thread safe ..
>> having a thread that does something else and doesn't call blender might
>> work ok. then a normal py thing run by blender could communicate with
>> that.
>>     
>
> I believe you have to explicitly release the GIL (and reacquire it) in
> the main thread for threads to really work at all.  What happens, is
> that the extra threads only get run when a python script gets events,
> and is pretty much dead the rest of the time.
>
>   
>> often though when you think you need threads, you don't, depends on the
>> prob.
>>
>>
>> ~Toni
>>
>>     
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20090616/4f314a6c/attachment.html>


More information about the Bf-python mailing list