diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-09-25 02:56:01 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-09-25 02:56:01 -0400 |
commit | 09ec0f3aab4df2993f4a2a992529655f6c4f7a70 (patch) | |
tree | 4109f54cb4bd53b6e21086bf905d53aa19fe7a28 /src/thread/pthread_cond_broadcast.c | |
parent | cba4e1c0a3423ed07ef5c79f6e29360996f32fd7 (diff) | |
download | musl-09ec0f3aab4df2993f4a2a992529655f6c4f7a70.tar.gz musl-09ec0f3aab4df2993f4a2a992529655f6c4f7a70.tar.xz musl-09ec0f3aab4df2993f4a2a992529655f6c4f7a70.zip |
fix logic for when wakeup is not desired on cond bcast
somehow i forgot that normal-type mutexes don't store the owner tid.
Diffstat (limited to 'src/thread/pthread_cond_broadcast.c')
-rw-r--r-- | src/thread/pthread_cond_broadcast.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/thread/pthread_cond_broadcast.c b/src/thread/pthread_cond_broadcast.c index 3daa7817..7e5ea91c 100644 --- a/src/thread/pthread_cond_broadcast.c +++ b/src/thread/pthread_cond_broadcast.c @@ -37,10 +37,11 @@ int pthread_cond_broadcast(pthread_cond_t *c) a_fetch_add(&m->_m_waiters, -w); } - /* Perform the futex requeue, waking one waiter if and only if - * the calling thread does not hold the mutex. */ + /* Perform the futex requeue, waking one waiter unless we know + * that the calling thread holds the mutex. */ __syscall(SYS_futex, &c->_c_block, FUTEX_REQUEUE, - m->_m_lock!=pthread_self()->tid, INT_MAX, &m->_m_lock); + !m->_m_type || (m->_m_lock&INT_MAX)!=pthread_self()->tid, + INT_MAX, &m->_m_lock); unlock(c); return 0; |