fix deadlock in condition wait whenever there are multiple waiters
[musl] / src / thread / pthread_cond_broadcast.c
1 #include "pthread_impl.h"
2
3 int pthread_cond_broadcast(pthread_cond_t *c)
4 {
5         int w = c->_c_waiters;
6         if (a_swap(&c->_c_block, 0) || w)
7                 __wake(&c->_c_block, -1, 0);
8         return 0;
9 }