"Martin v. Löwis"
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.
No, in fact there are several places where the API docs are less-than-scrupulous about letting you know that your own event dispatching hook may be re-entered during the call. It's been a long time since I've had the pleasure, but IIRC one of them happens in the APIs for printing. -- David Abrahams email@example.com * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution