S
Svein Seldal
Hi
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?
PyGILState_STATE gstate;
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();
PyEval_AcquireThread(pts);
PyObject_CallObject(...);
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?
Regards,
Svein Seldal
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?
PyGILState_STATE gstate;
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();
PyEval_AcquireThread(pts);
PyObject_CallObject(...);
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?
Regards,
Svein Seldal