[Python-Dev] Extension modules, Threading, and the GIL

"Martin v. Löwis" martin@v.loewis.de
Wed, 08 Jan 2003 19:30:46 +0100


David Abrahams wrote:
> OK.  I guess there's one more point worth mentioning: APIs are not
> always scrupulously documented.  In particular, documentation might
> give you no reason to think any callbacks will be invoked for a given
> call, when in fact it will be.
[...]
> The Windows API is a prime example of this

Are you sure about this? I would expect that the documentation of the 
Win32 API is very clear about when and how user code is invoked. More 
precisely, no API function except DispatchEvent will ever invoke user code.

Maybe you meant "Windows API" in a more general sense? If you include 
COM, then yes, any invocation of a COM object may do many things, so you 
should always release the GIL when invoking a COM method.

Regards,
Martin