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.
This commit is contained in:
Rich Felker 2015-03-07 14:11:01 -05:00
parent 559de8f5f0
commit a46677af18
1 changed files with 1 additions and 0 deletions

View File

@ -100,6 +100,7 @@ int __pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restri
__pthread_mutex_unlock(m); __pthread_mutex_unlock(m);
__pthread_setcancelstate(PTHREAD_CANCEL_MASKED, &cs); __pthread_setcancelstate(PTHREAD_CANCEL_MASKED, &cs);
if (cs == PTHREAD_CANCEL_DISABLE) __pthread_setcancelstate(cs, 0);
do e = __timedwait_cp(fut, seq, clock, ts, !shared); do e = __timedwait_cp(fut, seq, clock, ts, !shared);
while (*fut==seq && (!e || e==EINTR)); while (*fut==seq && (!e || e==EINTR));