about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-09 22:27:56 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-10 01:03:53 +0000
commit7e7182256a104da518018a0b4edfe51689487f42 (patch)
treeeb00e9a0941c0db5ff468cfe4da4ee7af86b55d7
parent59b7fe99f2593682ba779fe0faa8f1156d48d087 (diff)
downloadglibc-7e7182256a104da518018a0b4edfe51689487f42.tar.gz
glibc-7e7182256a104da518018a0b4edfe51689487f42.tar.xz
glibc-7e7182256a104da518018a0b4edfe51689487f42.zip
hurd: Make nanosleep a cancellation point
-rw-r--r--sysdeps/mach/clock_nanosleep.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdeps/mach/clock_nanosleep.c b/sysdeps/mach/clock_nanosleep.c
index ae9335cb2b..23ebc15274 100644
--- a/sysdeps/mach/clock_nanosleep.c
+++ b/sysdeps/mach/clock_nanosleep.c
@@ -22,6 +22,7 @@
 #include <unistd.h>
 #include <posix-timer.h>
 #include <shlib-compat.h>
+#include <sysdep-cancel.h>
 
 static int
 nanosleep_call (const struct timespec *req, struct timespec *rem)
@@ -39,9 +40,13 @@ nanosleep_call (const struct timespec *req, struct timespec *rem)
   if (rem != NULL)
     __clock_gettime (CLOCK_REALTIME, &before);
 
+  int cancel_oldtype = LIBC_CANCEL_ASYNC();
   err = __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
                     0, 0, recv, ms, MACH_PORT_NULL);
+  LIBC_CANCEL_RESET (cancel_oldtype);
+
   __mach_port_destroy (mach_task_self (), recv);
+
   if (err == EMACH_RCV_INTERRUPTED)
     {
       if (rem != NULL)