(pthread_cond_wait): Also check whether thread is cancelable before
authordrepper <drepper>
Wed, 26 Jul 2000 02:14:42 +0000 (02:14 +0000)
committerdrepper <drepper>
Wed, 26 Jul 2000 02:14:42 +0000 (02:14 +0000)
aborting loop.
(pthread_cond_timedwait): Likewise.

linuxthreads/condvar.c

index ae1cef1..f9c46a3 100644 (file)
@@ -103,7 +103,8 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
     {
       suspend(self);
       if (THREAD_GETMEM(self, p_condvar_avail) == 0
-         && THREAD_GETMEM(self, p_woken_by_cancel) == 0)
+         && (THREAD_GETMEM(self, p_woken_by_cancel) == 0
+             || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE))
        {
          /* Count resumes that don't belong to us. */
          spurious_wakeup_count++;
@@ -196,7 +197,8 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond,
       }
 
       if (THREAD_GETMEM(self, p_condvar_avail) == 0
-         && THREAD_GETMEM(self, p_woken_by_cancel) == 0)
+         && (THREAD_GETMEM(self, p_woken_by_cancel) == 0
+             || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE))
        {
          /* Count resumes that don't belong to us. */
          spurious_wakeup_count++;