Skip to content
Snippets Groups Projects
  • Deucе's avatar
    3328daec
    Add a pair of condition variables to help avoid spinning. · 3328daec
    Deucе authored
    Instead of tight loops with 1ms Sleep()s in them, add events for
    zero readers and zero writers that we can wait for instead.
    
    Unfortunately, since Events aren't interlocked with a critical section
    like condition variables are with mutexes in pthreads, we can't
    rely on this for race-free code, so for read locks, we still may
    spin under write pressure.
    3328daec
    History
    Add a pair of condition variables to help avoid spinning.
    Deucе authored
    Instead of tight loops with 1ms Sleep()s in them, add events for
    zero readers and zero writers that we can wait for instead.
    
    Unfortunately, since Events aren't interlocked with a critical section
    like condition variables are with mutexes in pthreads, we can't
    rely on this for race-free code, so for read locks, we still may
    spin under write pressure.