From f28535801e44e27aeb820b5214a836c2fdf45a6f Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Mon, 8 Oct 2012 08:13:12 +0000 Subject: Fixed #1592: Multithreading issues in PJSIP (fixing pj_timer_heap_poll() and lock order inversion in tcp/tls transport) git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4281 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pj/timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pjlib/src') diff --git a/pjlib/src/pj/timer.c b/pjlib/src/pj/timer.c index ad037068..767a261f 100644 --- a/pjlib/src/pj/timer.c +++ b/pjlib/src/pj/timer.c @@ -512,15 +512,16 @@ PJ_DEF(unsigned) pj_timer_heap_poll( pj_timer_heap_t *ht, PJ_ASSERT_RETURN(ht, 0); + lock_timer_heap(ht); if (!ht->cur_size && next_delay) { next_delay->sec = next_delay->msec = PJ_MAXINT32; + unlock_timer_heap(ht); return 0; } count = 0; pj_gettickcount(&now); - lock_timer_heap(ht); while ( ht->cur_size && PJ_TIME_VAL_LTE(ht->heap[0]->_timer_value, now) && count < ht->max_entries_per_poll ) -- cgit v1.2.3