diff options
Diffstat (limited to 'libc/signal/sigpause.c')
-rw-r--r-- | libc/signal/sigpause.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index e465fac7a..8c4e83e76 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -23,7 +23,9 @@ #define __FAVOR_BSD #include <signal.h> #include <stddef.h> /* For NULL. */ -#include <string.h> +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#include <sysdep-cancel.h> +#endif #include "sigset-cvt-mask.h" @@ -45,6 +47,9 @@ int __sigpause (int sig_or_mask, int is_sig) else sigset_set_old_mask (&set, sig_or_mask); + /* Note the sigpause() is a cancellation point. But since we call + sigsuspend() which itself is a cancellation point we do not have + to do anything here. */ return sigsuspend (&set); } libc_hidden_def(__sigpause) @@ -56,5 +61,18 @@ libc_hidden_def(__sigpause) the BSD version. So make this the default. */ int sigpause (int mask) { +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + if (SINGLE_THREAD_P) + return __sigpause (mask, 0); + + int oldtype = LIBC_CANCEL_ASYNC (); + + int result = __sigpause (mask, 0); + + LIBC_CANCEL_RESET (oldtype); + + return result; +#else return __sigpause (mask, 0); +#endif } |