From: Rich Felker Date: Sat, 7 Mar 2015 19:11:01 +0000 (-0500) Subject: fix regression in pthread_cond_wait with cancellation disabled X-Git-Tag: v1.1.7~14 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a46677af1863f3d050f216a43dfdf4818210c266;p=oweals%2Fmusl.git 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. --- 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));