Multithreaded C API Python questions
svein at seldal dot com
Thu Nov 9 13:49:07 CET 2006
A couple of mulithreaded C API python questions:
I) The PyGILState_Ensure() simply ensures python api call ability, it
doesnt actually lock the GIL, right?
gstate = PyGILState_Ensure();
II) Am I required to lock the GIL prior to running any python functions
(in a threaded app)?
PyThreadState *pts = PyGILState_GetThisThreadState();
III) Shouldn't the GIL be released after 100 bytecodes or so to enable
other waiting threads to get the GIL?
I'm unable to get access to python as long as another python call is
executing. The PyEval_AcquireThread() call blocks until the first call
returns. I was hoping that the python system itself would release the
GIL after some execution, but it itsnt.
I am dependent upon the ability to have to threads executing in python
land at the same time. How can this be done?
More information about the Python-list