[XML-SIG] Advice on how to deal with locking problems using python-wrapped C libs in MT frameworks like Zope/Twisted?
Mon, 31 Mar 2003 05:09:20 -0500
On Mon, Mar 31, 2003 at 11:35:35AM +0200, M.-A. Lemburg wrote:
> Daniel Veillard wrote:
> > No idea what the GIL is, I don't take nor release any lock at the C or
> > python level.
> The GIL is the global Python interpreter lock. A Python extension
> can release it whenever long running IO will happen. When using
> callbacks you have to watch out though because releasing the GIL
> can cause the interpreter to call back into your extension,
> so that'll have to be thread safe.
Seems rather that the Python interpreter itself is not reentrant !
> Here's an example of how to release the GIL in C:
> /* Call into some C lib */
Hum, of course I assume it's an expensive operation. As a result
I can't generate it for all calls to libxml2 or libxslt, and which
call need it or not need to be manually selected, it's not something
which can be automated. As a result it's a request for enhancement
of my Python bindings but since it requires going over the full
set of entry point manually, and an update of the bindings generator
don't expect it to be done quickly.
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
email@example.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/