refactor malloc's expand_heap to share with __simple_malloc
[musl] / src / thread / pthread_cond_broadcast.c
index 7a023b8..69f840f 100644 (file)
@@ -1,8 +1,12 @@
 #include "pthread_impl.h"
 
+int __private_cond_signal(pthread_cond_t *, int);
+
 int pthread_cond_broadcast(pthread_cond_t *c)
 {
-       c->__block = 0;
-       __wake(&c->__block, -1, 0);
+       if (!c->_c_shared) return __private_cond_signal(c, -1);
+       if (!c->_c_waiters) return 0;
+       a_inc(&c->_c_seq);
+       __wake(&c->_c_seq, -1, 0);
        return 0;
 }