Ignore:
Timestamp:
Oct 31, 2007 7:53:17 AM (17 years ago)
Author:
bennylp
Message:

Fixed deadlock in increment_counter() and decrement_counter() caused by different lock order (thanks Phil Torre)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ioqueue_select.c

    r1440 r1531  
    393393static void decrement_counter(pj_ioqueue_key_t *key) 
    394394{ 
     395    pj_lock_acquire(key->ioqueue->lock); 
    395396    pj_mutex_lock(key->ioqueue->ref_cnt_mutex); 
    396397    --key->ref_count; 
     
    402403        pj_time_val_normalize(&key->free_time); 
    403404 
    404         pj_lock_acquire(key->ioqueue->lock); 
    405405        pj_list_erase(key); 
    406406        pj_list_push_back(&key->ioqueue->closing_list, key); 
    407407        /* Rescan fdset to get max descriptor */ 
    408408        rescan_fdset(key->ioqueue); 
    409         pj_lock_release(key->ioqueue->lock); 
    410409    } 
    411410    pj_mutex_unlock(key->ioqueue->ref_cnt_mutex); 
     411    pj_lock_release(key->ioqueue->lock); 
    412412} 
    413413#endif 
Note: See TracChangeset for help on using the changeset viewer.