X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fthread%2Fpthread_cond_broadcast.c;fp=src%2Fthread%2Fpthread_cond_broadcast.c;h=848e288f5ea6dc25de38b901210bbace6f2bc2de;hp=9c6a462b781bd5bb6435df47f6890c02c41b2f4a;hb=3bec53e0d3bb5e74d2e2dca34f50aadfaf832607;hpb=1fa05210100caefc8546746e08358d81739f4b41 diff --git a/src/thread/pthread_cond_broadcast.c b/src/thread/pthread_cond_broadcast.c index 9c6a462b..848e288f 100644 --- a/src/thread/pthread_cond_broadcast.c +++ b/src/thread/pthread_cond_broadcast.c @@ -22,12 +22,8 @@ int pthread_cond_broadcast(pthread_cond_t *c) m = c->_c_mutex; /* Move waiter count to the mutex */ - for (;;) { - int w = c->_c_waiters2; - a_fetch_add(&m->_m_waiters, w); - if (a_cas(&c->_c_waiters2, w, 0) == w) break; - a_fetch_add(&m->_m_waiters, -w); - } + a_fetch_add(&m->_m_waiters, c->_c_waiters2); + c->_c_waiters2 = 0; /* Perform the futex requeue, waking one waiter unless we know * that the calling thread holds the mutex. */