Extension modules, Threading, and the GIL
The following message is a courtesy copy of an article
that has been posted to comp.lang.python as well.
David Abrahams
Aahz
writes: I think this thread might be better handled on c.l.py, at least until it's understood well enough to be clear whether something does need to change in Python.
I'm pretty certain I understand what's going on. If it would be better for you to take this to c.l.py, I'm happy to do so, but AFAICT there _is_ a Python core issue here: there's no way to find out whether you've already got the GIL**, so if you _might_ have to acquire it, you must always acquire it.
**If I'm wrong about that, please let me know. It isn't obvious from the documentation.
This is the continuation of a thread originated on python-dev; I was asked to re-raise it here on python-list until the issue is better understood. The original posting was here: http://aspn.activestate.com/ASPN/Mail/Message/python-dev/1482879 The he essence of the problem is that there's no way to write code that uses the Python 'C' API and which has no knowledge of whether it is running on Python's main thread when it is entered. The two respondents were left with some questions; you can read those, and my responses, in the thread at the bottom of the page referenced above. Thanks for your attention, Dave -- David Abrahams dave@boost-consulting.com * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
participants (1)
-
David Abrahams