فهرست منبع

fix failure of internal futex __timedwait to report ECANCELED

as part of abstracting the futex wait, this function suppresses all
futex error values which callers should not see using a whitelist
approach. when the masked cancellation mode was added, the new
ECANCELED error was not whitelisted. this omission caused the new
pthread_cond_wait code using masked cancellation to exhibit a spurious
wake (rather than acting on cancellation) when the request arrived
after blocking on the cond var.
Rich Felker 10 سال پیش
والد
کامیت
76ca7a5446
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      src/thread/__timedwait.c

+ 1 - 1
src/thread/__timedwait.c

@@ -33,7 +33,7 @@ int __timedwait(volatile int *addr, int val,
 
 	r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT|priv, val, top);
 	if (r == ENOSYS) r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT, val, top);
-	if (r != EINTR && r != ETIMEDOUT) r = 0;
+	if (r != EINTR && r != ETIMEDOUT && r != ECANCELED) r = 0;
 
 	pthread_cleanup_pop(0);
 	if (!cleanup) __pthread_setcancelstate(cs, 0);