extension call backs and the GIL

Robin Becker robin at jessikat.fsnet.co.uk
Mon Sep 29 08:35:34 EDT 2003


In article <bl93hp$mgc$1 at panix3.panix.com>, Aahz <aahz at pythoncraft.com>
writes
>In article <pUnrihASxAe$EwRO at jessikat.fsnet.co.uk>,
>Robin Becker  <robin at jessikat.fsnet.co.uk> wrote:
>>
>>I'm trying to better my understanding of multithreading. I believe a
>>thread that calls an extension must have the GIL. What happens if the
>>extension then calls back into Python? Can a function or method somehow
>>'belong' to a different thread? My understanding was that things should
>>be OK provided the extension code doesn't mess with the GIL (which it
>>doesn't).
>
>You need to reacquire the GIL prior to making the callback.
So does calling an extension release the GIL? I believed the opposite
for some reason.
-- 
Robin Becker




More information about the Python-list mailing list