[Python-Dev] Problem with PyGILState_Ensure() and the thread Module
Phil Thompson
phil at riverbankcomputing.co.uk
Mon Aug 16 21:57:41 CEST 2004
I'm having a problem calling functions in a C extension module that uses
PyGILState_Ensure() and PyGILState_Release() from a thread created with
thread.start_new_thread().
A deadlock occurs in PyGILState_Ensure() because it doesn't know anything
about the thread state created by start_new_thread(). Therefore it creates a
new one and then calls PyEval_RestoreThread() - but it already holds the GIL
and so deadlocks.
I would expect the threading PyGILState_Ensure() to know about all thread
states - not just the ones it creates itself.
Is this a bug, feature, or misunderstanding on my part?
This is with Python 2.4a2.
Thanks,
Phil
More information about the Python-Dev
mailing list