Changeset 3882


Ignore:
Timestamp:
Nov 2, 2011 8:48:06 AM (13 years ago)
Author:
bennylp
Message:

Fixed #1415: Handle potential crash if joining worker thread fails in pjsua_destroy()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_core.c

    r3873 r3882  
    12921292    int i;  /* Must be signed */ 
    12931293 
     1294    PJ_LOG(4,(THIS_FILE, "Shutting down, flags=%d...", flags)); 
     1295 
    12941296    /* Signal threads to quit: */ 
    12951297    pjsua_var.thread_quit_flag = 1; 
     
    12981300    for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) { 
    12991301        if (pjsua_var.thread[i]) { 
    1300             pj_thread_join(pjsua_var.thread[i]); 
     1302            pj_status_t status; 
     1303            status = pj_thread_join(pjsua_var.thread[i]); 
     1304            if (status != PJ_SUCCESS) { 
     1305                PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread")); 
     1306                pj_thread_sleep(1000); 
     1307            } 
    13011308            pj_thread_destroy(pjsua_var.thread[i]); 
    13021309            pjsua_var.thread[i] = NULL; 
     
    13061313    if (pjsua_var.endpt) { 
    13071314        unsigned max_wait; 
    1308  
    1309         PJ_LOG(4,(THIS_FILE, "Shutting down, flags=%d...", flags)); 
    13101315 
    13111316        /* Terminate all calls. */ 
Note: See TracChangeset for help on using the changeset viewer.