Skip to content
Snippets Groups Projects
  • Jaco Kroon's avatar
    c7975009
    func_lock: fix multiple-channel-grant problems. · c7975009
    Jaco Kroon authored
    
    Under contention it becomes possible that multiple channels will be told
    they successfully obtained the lock, which is a bug.  Please refer
    
    ASTERISK-29217
    
    This introduces a couple of changes.
    
    1.  Replaces requesters ao2 container with simple counter (we don't
        really care who is waiting for the lock, only how many).  This is
        updated undex ->mutex to prevent memory access races.
    2.  Correct semantics for ast_cond_timedwait() as described in
        pthread_cond_broadcast(3P) is used (multiple threads can be released
        on a single _signal()).
    3.  Module unload races are taken care of and memory properly cleaned
        up.
    
    Change-Id: I6f68b5ec82ff25b2909daf6e4d19ca864a463e29
    Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
    c7975009
    History
    func_lock: fix multiple-channel-grant problems.
    Jaco Kroon authored
    
    Under contention it becomes possible that multiple channels will be told
    they successfully obtained the lock, which is a bug.  Please refer
    
    ASTERISK-29217
    
    This introduces a couple of changes.
    
    1.  Replaces requesters ao2 container with simple counter (we don't
        really care who is waiting for the lock, only how many).  This is
        updated undex ->mutex to prevent memory access races.
    2.  Correct semantics for ast_cond_timedwait() as described in
        pthread_cond_broadcast(3P) is used (multiple threads can be released
        on a single _signal()).
    3.  Module unload races are taken care of and memory properly cleaned
        up.
    
    Change-Id: I6f68b5ec82ff25b2909daf6e4d19ca864a463e29
    Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>