]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(pthread_cond_timedwait_relative): Never return with EINTR.
authorUlrich Drepper <drepper@redhat.com>
Sat, 25 Sep 1999 07:07:14 +0000 (07:07 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 25 Sep 1999 07:07:14 +0000 (07:07 +0000)
linuxthreads/condvar.c

index cd22a241af2bcaed7918eb26f4718c45a8843715..0ce852abaa77d569bbd64a66c9bcb9642b9e9541 100644 (file)
@@ -76,6 +76,7 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond,
   enqueue(&cond->__c_waiting, self);
   __pthread_unlock(&cond->__c_lock);
   pthread_mutex_unlock(mutex);
+ continue_waiting:
   /* Set up a longjmp handler for the restart and cancel signals */
   if (sigsetjmp(jmpbuf, 1) == 0) {
     THREAD_SETMEM(self, p_signal_jmp, &jmpbuf);
@@ -113,13 +114,16 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond,
     pthread_mutex_lock(mutex);
     pthread_exit(PTHREAD_CANCELED);
   }
-  /* If not signaled: also remove ourselves and return an error code */
+  /* If not signaled: also remove ourselves and return an error code, but
+     only if the timeout has elapsed.  If not, just continue waiting.  */
   if (THREAD_GETMEM(self, p_signal) == 0) {
+    if (retsleep != 0)
+      goto continue_waiting;
     __pthread_lock(&cond->__c_lock, self);
     remove_from_queue(&cond->__c_waiting, self);
     __pthread_unlock(&cond->__c_lock);
     pthread_mutex_lock(mutex);
-    return retsleep == 0 ? ETIMEDOUT : EINTR;
+    return ETIMEDOUT;
   }
   /* Otherwise, return normally */
   pthread_mutex_lock(mutex);