Ignore:
Timestamp:
Sep 19, 2006 1:37:53 PM (18 years ago)
Author:
bennylp
Message:

Fixed race-condition/deadlock problems in the dialog/user agent layer
all the way up to PJSUA-API:

  • standardized locking order: dialog then user agent, and dialog then PJSUA
  • any threads that attempt to acquire mutexes in different order than above MUST employ retry mechanism (for an example, see acquire_call() in pjsua_call.c). This retry mechanism has also been used in the UA layer (sip_ua_layer.c) since it needs to lock user agent layer first before the dialog.
  • introduced pjsip_dlg_try_inc_lock() and PJSUA_TRY_LOCK() to accomodate above.
  • pjsua tested on Quad Xeon with 4 threads and 200 cps, so far so good.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h

    r685 r729  
    258258 
    259259 
    260 #if 0 
    261 #define PJSUA_LOCK()        pj_mutex_lock(pjsua_var.mutex); 
    262 #define PJSUA_UNLOCK()      pj_mutex_unlock(pjsua_var.mutex); 
     260#if 1 
     261#define PJSUA_LOCK()        pj_mutex_lock(pjsua_var.mutex) 
     262#define PJSUA_TRY_LOCK()    pj_mutex_trylock(pjsua_var.mutex) 
     263#define PJSUA_UNLOCK()      pj_mutex_unlock(pjsua_var.mutex) 
    263264#else 
    264265#define PJSUA_LOCK() 
     266#define PJSUA_TRY_LOCK()    PJ_SUCCESS 
    265267#define PJSUA_UNLOCK() 
    266268#endif 
Note: See TracChangeset for help on using the changeset viewer.