Hi PJ peeps, Please apply this patch which removes the pj_thread_sleep() call from pjsip_endpt_handle_events2(). I think it makes more sense just to return the error to the user immediately and let them decide if they want to sleep (like pjsua-lib does). One concrete case when this sleep is problematic is when a signal occurs. In this case, the call to pj_ioqueue_poll() will return because of EINTR which will cause the main loop to additionally sleep for the full timeout. This means, if pjsip_endpt_handle_events2() is called with a large timeout, the signal/interrupt will block the app for the full timeout interval if a signal happens. This is a problem. Thanks, Kal
diff --git a/pjsip/src/pjsip/sip_endpoint.c b/pjsip/src/pjsip/sip_endpoint.c index 107ec125..48065562 100644 --- a/pjsip/src/pjsip/sip_endpoint.c +++ b/pjsip/src/pjsip/sip_endpoint.c @@ -742,7 +742,6 @@ PJ_DEF(pj_status_t) pjsip_endpt_handle_events2(pjsip_endpoint *endpt, c = pj_ioqueue_poll( endpt->ioqueue, &timeout); if (c < 0) { pj_status_t err = pj_get_netos_error(); - pj_thread_sleep(PJ_TIME_VAL_MSEC(timeout)); if (p_count) *p_count = count; return err;
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org