hurd: Make nanosleep a cancellation point

This commit is contained in:
Samuel Thibault 2020-02-09 22:27:56 +00:00
parent 59b7fe99f2
commit 7e7182256a
1 changed files with 5 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <unistd.h> #include <unistd.h>
#include <posix-timer.h> #include <posix-timer.h>
#include <shlib-compat.h> #include <shlib-compat.h>
#include <sysdep-cancel.h>
static int static int
nanosleep_call (const struct timespec *req, struct timespec *rem) 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) if (rem != NULL)
__clock_gettime (CLOCK_REALTIME, &before); __clock_gettime (CLOCK_REALTIME, &before);
int cancel_oldtype = LIBC_CANCEL_ASYNC();
err = __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT, err = __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
0, 0, recv, ms, MACH_PORT_NULL); 0, 0, recv, ms, MACH_PORT_NULL);
LIBC_CANCEL_RESET (cancel_oldtype);
__mach_port_destroy (mach_task_self (), recv); __mach_port_destroy (mach_task_self (), recv);
if (err == EMACH_RCV_INTERRUPTED) if (err == EMACH_RCV_INTERRUPTED)
{ {
if (rem != NULL) if (rem != NULL)