[C++-sig] Patch to add thread support to invoke function.

Lijun Qin qinlj at solidshare.com
Wed Aug 27 04:44:39 CEST 2003


Hi,

I have made some changes to the invoke.hpp file, to add

Py_UNBLOCK_THREADS
 result = f(...);
Py_BLOCK_THREADS

pair, this is need for too reasons:
First, if the f(...) is a lengthy operation, it'll block all Python code to
execute, this is not good,
second, if f(...) function call some functions that will acquire the python
global lock, it'll deadlock, one example is the COM inproc server using
Pythoncom22.dll, every COM interface method will first call
PyEval_AcquireThread, but the global lock has been held, so deadlock occur.

Lijun Qin
http://www.solidshare.com



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: invoke.hpp
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030827/cb3c432b/attachment.txt>


More information about the Cplusplus-sig mailing list