summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-03-07 14:11:01 -0500
committerRich Felker <dalias@aerifal.cx>2015-03-07 14:11:01 -0500
commita46677af1863f3d050f216a43dfdf4818210c266 (patch)
treef29c74310778234adafe0f6bb1d5f290d4334faf
parent559de8f5f06da9022cbba70e22e14a710eb74513 (diff)
downloadmusl-a46677af1863f3d050f216a43dfdf4818210c266.tar.gz
musl-a46677af1863f3d050f216a43dfdf4818210c266.tar.bz2
musl-a46677af1863f3d050f216a43dfdf4818210c266.tar.xz
musl-a46677af1863f3d050f216a43dfdf4818210c266.zip
fix regression in pthread_cond_wait with cancellation disabled
due to a logic error in the use of masked cancellation mode, pthread_cond_wait did not honor PTHREAD_CANCEL_DISABLE but instead failed with ECANCELED when cancellation was pending.
-rw-r--r--src/thread/pthread_cond_timedwait.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/thread/pthread_cond_timedwait.c b/src/thread/pthread_cond_timedwait.c
index 27b1a99a..3526ecfb 100644
--- a/src/thread/pthread_cond_timedwait.c
+++ b/src/thread/pthread_cond_timedwait.c
@@ -100,6 +100,7 @@ int __pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restri
__pthread_mutex_unlock(m);
__pthread_setcancelstate(PTHREAD_CANCEL_MASKED, &cs);
+ if (cs == PTHREAD_CANCEL_DISABLE) __pthread_setcancelstate(cs, 0);
do e = __timedwait_cp(fut, seq, clock, ts, !shared);
while (*fut==seq && (!e || e==EINTR));