This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: if extended c module is calling Windows API waitForSingleObject, it will block other thread.
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: patrick, therve
Priority: normal Keywords:

Created on 2008-06-02 09:53 by patrick, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
attach.zip patrick, 2008-06-02 09:53 source and output files
Messages (3)
msg67633 - (view) Author: patrick (patrick) Date: 2008-06-02 09:53
The c extend module is as the attached file "WindowsFuncs.cpp", it 
wraps some Windows event APIs

The python script is as the attached file "test.py", run that script, 
we could find in the new thread, the calling to Windows API 
waitForSingleObject will block the main thread printing, that's really 
strange. 

The output of running is as the attached file "test.output".
msg67634 - (view) Author: Thomas Herve (therve) * Date: 2008-06-02 11:21
You have to release the GIL. See http://docs.python.org/api/threads.html
for some information.
msg67648 - (view) Author: patrick (patrick) Date: 2008-06-03 02:58
Yes, after wrapping the calling to block operation with marco 
Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS, that issue is gone. 
Thank you.
History
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47277
2008-06-03 07:18:36georg.brandlsetstatus: open -> closed
resolution: works for me
2008-06-03 02:58:26patricksetmessages: + msg67648
2008-06-02 11:21:20thervesetnosy: + therve
messages: + msg67634
2008-06-02 09:53:19patrickcreate