diff options
Diffstat (limited to 'pjsip-apps')
-rw-r--r-- | pjsip-apps/src/py_pjsua/py_pjsua.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pjsip-apps/src/py_pjsua/py_pjsua.c b/pjsip-apps/src/py_pjsua/py_pjsua.c index cb370f1e..e5cb6caf 100644 --- a/pjsip-apps/src/py_pjsua/py_pjsua.c +++ b/pjsip-apps/src/py_pjsua/py_pjsua.c @@ -2163,7 +2163,15 @@ static PyObject *py_pjsua_handle_events(PyObject *pSelf, PyObject *pArgs) { return NULL; } + + /* Since handle_events() will block, we must wrap it with ALLOW_THREADS + * construct, or otherwise many Python blocking functions (such as + * time.sleep(), readline(), etc.) may hang/block indefinitely. + * See http://www.python.org/doc/current/api/threads.html for more info. + */ + Py_BEGIN_ALLOW_THREADS ret = pjsua_handle_events(msec); + Py_END_ALLOW_THREADS return Py_BuildValue("i",ret); } |