Ignore:
Timestamp:
Mar 22, 2012 11:29:20 AM (12 years ago)
Author:
nanang
Message:

Close #1466 (using PJLIB outside PJSUA-LIB context):

  • static reference counter for PJLIB init/shutdown.
  • implemented atexit() in PJMEDIA and PJSIP level: pjmedia_endpt_atexit() & pjsip_endpt_atexit().
  • updated pjmedia/transport_srtp.c, pjsip/sip_timer.c, and pjsip/sip_replaces.c to use the new atexit() functions.
  • API change: pjmedia_srtp_init_lib() now requires 'pjmedia_endpt' param.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjlib/src/pj/os_core_symbian.cpp

    r3553 r3986  
    7676}; 
    7777 
     78/* Flag and reference counter for PJLIB instance */ 
     79static int initialized; 
     80 
    7881/* Flags to indicate which TLS variables have been used */ 
    7982static int tls_vars[PJ_MAX_TLS]; 
     
    8285static unsigned atexit_count; 
    8386static void (*atexit_func[32])(void); 
    84  
    85  
    8687 
    8788 
     
    336337    pj_status_t status; 
    337338     
     339    /* Check if PJLIB have been initialized */ 
     340    if (initialized) { 
     341        ++initialized; 
     342        return PJ_SUCCESS; 
     343    } 
     344 
    338345    pj_ansi_strcpy(main_thread.obj_name, "pjthread"); 
    339346 
     
    369376#endif 
    370377 
     378    /* Flag PJLIB as initialized */ 
     379    ++initialized; 
     380    pj_assert(initialized == 1); 
     381 
    371382    PJ_LOG(5,(THIS_FILE, "PJLIB initialized.")); 
    372383    return PJ_SUCCESS; 
     
    391402PJ_DEF(void) pj_shutdown(void) 
    392403{ 
     404    /* Only perform shutdown operation when 'initialized' reaches zero */ 
     405    pj_assert(initialized > 0); 
     406    if (--initialized != 0) 
     407        return; 
     408 
    393409    /* Call atexit() functions */ 
    394410    while (atexit_count > 0) { 
Note: See TracChangeset for help on using the changeset viewer.