• R
    retry on cas failures in sem_trywait · 07e62953
    Rich Felker 提交于
    this seems counter-intuitive since sem_trywait is supposed to just try
    once, not wait for the semaphore. however, the retry loop is not a
    wait. instead, it's to handle the case where the value changes due to
    a simultaneous post or wait from another thread while the semaphore
    value remains positive. in such a case, it's absolutely wrong for
    sem_trywait to fail with EAGAIN because the semaphore is not busy.
    07e62953
sem_trywait.c 254 字节