I've been trying for a day or so to use the new PyGILState_Ensure() and PyGILState_Release() calls. I started with a Python multi-threaded test case and a simple hypothetical extension function. I want to protect the extension function in case it gets called from an embedded context by a non-Python thread. (In truth, I started with numarray stuff where this makes slightly more sense; I wanted to protect an API function.) It is now my impression that an extension function with the following core contents: { PyGILState_STATE state = PyGILState_Ensure(); int i; for(i=0; i<100000; i++); PyGILState_Release(state); } will deadlock (in the Ensure), provided it is called from some secondary thread from Python. I thought this would be OK and that the Ensure/Release would essentially be a noop. Did I misread the PEP? Is the PEP-311 code finished yet? (I tried this under Red Hat 8 and Windows 2000 pro with Python CVS) Thanks, Todd
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4