Ronald Oussoren <ronaldousso...@mac.com> added the comment:

I don't think this is a bug:

- PyGILState_Ensure() acquires the GIL when it is not already acquired (and can 
be called without checking).  

It cannot acquire the GIL when some other thread has already taken the GIL, but 
wait until the GIL is released.  The GIL will get released periodically when 
running Python code.  

If the thread holding the GIL is primarily running native code that doesn't use 
the Python API it should release the GIL (for example by bracketing the 
long-running C code with Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS)


- PyGILState_Release() restores the state from before the call to 
PyGILState_Ensure().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38680>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to