about summary refs log tree commit diff
path: root/sysdeps/htl
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-10 00:52:50 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-10 01:03:54 +0000
commite9644c20ce4718ca99953cab0d306b7789303c8e (patch)
tree89e57ee542ffff864375f9631e4301bbea3991ea /sysdeps/htl
parent1cec114b17ad2d5b019074e3cd419cb331feac7a (diff)
downloadglibc-e9644c20ce4718ca99953cab0d306b7789303c8e.tar.gz
glibc-e9644c20ce4718ca99953cab0d306b7789303c8e.tar.xz
glibc-e9644c20ce4718ca99953cab0d306b7789303c8e.zip
htl: Make sem_wait/sem_timedwait interruptible
Diffstat (limited to 'sysdeps/htl')
-rw-r--r--sysdeps/htl/sem-timedwait.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sysdeps/htl/sem-timedwait.c b/sysdeps/htl/sem-timedwait.c
index 656da41184..a61acfd43f 100644
--- a/sysdeps/htl/sem-timedwait.c
+++ b/sysdeps/htl/sem-timedwait.c
@@ -30,6 +30,7 @@ __sem_timedwait_internal (sem_t *restrict sem,
   error_t err;
   int drain;
   struct __pthread *self;
+  clockid_t clock_id = CLOCK_REALTIME;
 
   __pthread_spin_lock (&sem->__lock);
   if (sem->__value > 0)
@@ -54,12 +55,9 @@ __sem_timedwait_internal (sem_t *restrict sem,
 
   /* Block the thread.  */
   if (timeout != NULL)
-    err = __pthread_timedblock (self, timeout, CLOCK_REALTIME);
+    err = __pthread_timedblock_intr (self, timeout, clock_id);
   else
-    {
-      err = 0;
-      __pthread_block (self);
-    }
+    err = __pthread_block_intr (self);
 
   __pthread_spin_lock (&sem->__lock);
   if (self->prevp == NULL)
@@ -82,7 +80,7 @@ __sem_timedwait_internal (sem_t *restrict sem,
 
   if (err)
     {
-      assert (err == ETIMEDOUT);
+      assert (err == ETIMEDOUT || err == EINTR);
       errno = err;
       return -1;
     }