Opened 18 years ago
Closed 18 years ago
#93 closed defect (fixed)
Python application blocks in sys.stdin.readline() because C module running on different thread is calling a blocking OS function
Reported by: | bennylp | Owned by: | bennylp |
---|---|---|---|
Priority: | blocker | Milestone: | release-0.5.10 |
Component: | applications | Version: | 0.5.9 |
Keywords: | Cc: | ||
Backport to 1.x milestone: | Backported: |
Description
On Linux (or at least my Linux), pjsua_app.py application will block forever on sys.stdin.readline(), and somehow this is related to the other thread calling py_pjsua.handle_events() (if this is commented, the keyboard input will function properly).
Change History (2)
comment:1 Changed 18 years ago by bennylp
- Priority changed from normal to blocker
comment:2 Changed 18 years ago by bennylp
- Resolution set to fixed
- Status changed from new to closed
- Summary changed from Python application blocks in sys.stdin.readline() to Python application blocks in sys.stdin.readline() because C module running on different thread is calling a blocking OS function
Note: See
TracTickets for help on using
tickets.
Fixed in r945.
It turns out that when a C module needs to call a blocking function call, it really should wrap the blocking call with Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS macros.
This article provides some information on this:
http://www.python.org/doc/current/api/threads.html