Prev Next | OpenBSD and Rthreads | Slide #26 |
Inefficient
pthread_cond_broadcast() wakes up everyone, but they all have to immediately block on the mutex
Not Safe
T1: mutex_lock(&mutex) T1: cond_wait(&cond, &mutex) /* down */ T2: mutex_lock(&mutex) T2: cond_signal(&cond) /* up */ T2: cond_wait(&cond, &mutex) /* down */
pthread_cond_signal() could consume its own signal
non-compliant
programs *do* depend on that not happening
EuroBSDCon 2012 | Copyright © 2012 Philip Guenther |