2 years ago
#49770
Jack
PyGILState_STATE didn't change after PyGILState_Ensure()/PyGILState_Release()
I have a shared library written in C and called in Python.
In a pthread, some Python C API called between PyGILState_Ensure() and PyGILState_Release().
The value of PyGILState_STATE remains the same all the time.
c code
PyGILState_STATE st = PyGILState_Ensure()
printf("After Ensure, PyGILState_STATE == %d\n", st);
// Python C API call
PyGILState_Release(st);
printf("After Release, PyGILState_STATE == %d\n", st);
output
After Ensure, PyGILState_STATE == 1
After Release, PyGILState_STATE == 1
According to its definition, 1 means PyGILState_UNLOCKED.
typedef
enum {PyGILState_LOCKED, PyGILState_UNLOCKED}
PyGILState_STATE;
Why didn't the state change ?
c
python-2.7
python-c-api
0 Answers
Your Answer