Changeset 730 for pjproject


Ignore:
Timestamp:
Sep 19, 2006 9:29:19 PM (18 years ago)
Author:
bennylp
Message:

Fixed race condition bug when initializing SDP parser on multi-processor machine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/sdp.c

    r609 r730  
    7272static void init_sdp_parser(void) 
    7373{ 
    74     if (is_initialized == 0) { 
    75         is_initialized = 1; 
    76         if (is_initialized != 1) { 
    77             return; 
    78         } 
    79     } 
    80  
     74    if (is_initialized != 0) 
     75        return; 
     76 
     77    pj_enter_critical_section(); 
     78 
     79    if (is_initialized != 0) { 
     80        pj_leave_critical_section(); 
     81        return; 
     82    } 
     83     
    8184    pj_cis_buf_init(&cis_buf); 
    8285 
     
    8891    pj_cis_init(&cis_buf, &cs_digit); 
    8992    pj_cis_add_num(&cs_digit); 
     93 
     94    is_initialized = 1; 
     95    pj_leave_critical_section(); 
    9096} 
    9197 
     
    11151121        session = NULL; 
    11161122 
     1123        pj_assert(ctx.last_error == PJ_SUCCESS); 
    11171124    } 
    11181125    PJ_END; 
Note: See TracChangeset for help on using the changeset viewer.