Ignore:
Timestamp:
Mar 22, 2012 11:29:20 AM (9 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_win32.c

    r3553 r3986  
    118118 
    119119/* 
     120 * Flag and reference counter for PJLIB instance. 
     121 */ 
     122static int initialized; 
     123 
     124/* 
    120125 * Static global variables. 
    121126 */ 
     
    142147    pj_str_t guid; 
    143148    pj_status_t rc; 
     149 
     150    /* Check if PJLIB have been initialized */ 
     151    if (initialized) { 
     152        ++initialized; 
     153        return PJ_SUCCESS; 
     154    } 
    144155 
    145156    /* Init Winsock.. */ 
     
    188199#endif    
    189200 
     201    /* Flag PJLIB as initialized */ 
     202    ++initialized; 
     203    pj_assert(initialized == 1); 
     204 
    190205    PJ_LOG(4,(THIS_FILE, "pjlib %s for win32 initialized", 
    191206              PJ_VERSION)); 
     
    213228{ 
    214229    int i; 
     230 
     231    /* Only perform shutdown operation when 'initialized' reaches zero */ 
     232    pj_assert(initialized > 0); 
     233    if (--initialized != 0) 
     234        return; 
    215235 
    216236    /* Display stack usage */ 
Note: See TracChangeset for help on using the changeset viewer.