extension call backs and the GIL

Robin Becker robin at jessikat.fsnet.co.uk
Mon Sep 29 20:36:44 CEST 2003

In article <bl9jh3$gc4$1 at panix3.panix.com>, Aahz <aahz at pythoncraft.com>
>Looks like Bernhard has put you on the right track, but just for the
>record: calling an extension does not automatically release the GIL; you
>need to explicitly call the Py_BEGIN_ALLOW_THREADS macro.  I was just
>assuming that because you said "accelerator" you were already releasing
>the GIL.
The code is intended to run single thread so we never have done anything
about threading. It's a real pain. In a zope world we ought really to
give every request a fresh context ie each thread would see an entirely
'clean' python and then be forced to load its own fonts/resources. It
just sucks from the overall system viewpoint. How does one ensure that
each thread sees its own version of sys.modules etc etc or is that
considered a dumb question? 
Robin Becker

More information about the Python-list mailing list