X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fpthread_cond_broadcast.c;h=69f840fb4faee7d1f402771dba6f02b157a935c5;hb=eb4bd8d8bb5c9f535ee8250edd4efbd3d4f84c5a;hp=6002c53507be55152328caacd3394614daa0dffd;hpb=4b153ac42428447a148e6da543ebe6df017078db;p=musl diff --git a/src/thread/pthread_cond_broadcast.c b/src/thread/pthread_cond_broadcast.c index 6002c535..69f840fb 100644 --- a/src/thread/pthread_cond_broadcast.c +++ b/src/thread/pthread_cond_broadcast.c @@ -1,9 +1,12 @@ #include "pthread_impl.h" +int __private_cond_signal(pthread_cond_t *, int); + int pthread_cond_broadcast(pthread_cond_t *c) { - int w = c->_c_waiters; - if (a_swap(&c->_c_block, 0) || w) - __wake(&c->_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; }