diff --git a/channels/chan_h323.c b/channels/chan_h323.c index d2cc44e58fc963b4fba25073e2076fd1255070eb..f0261c9ca92b0e7cbe98549dd41360ad7cd799e3 100755 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -1238,13 +1238,14 @@ restartsearch: } ast_mutex_unlock(&iflock); - pthread_testcancel(); - /* Wait for sched or io */ res = ast_sched_wait(sched); if ((res < 0) || (res > 1000)) res = 1000; res = ast_io_wait(io, res); + + pthread_testcancel(); + ast_mutex_lock(&monlock); if (res >= 0) ast_sched_runq(sched);