summaryrefslogtreecommitdiff
path: root/libc/signal/sigpause.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/signal/sigpause.c')
-rw-r--r--libc/signal/sigpause.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c
index 5f7ed699a..0856ba2e6 100644
--- a/libc/signal/sigpause.c
+++ b/libc/signal/sigpause.c
@@ -23,6 +23,9 @@
#define __FAVOR_BSD
#include <signal.h>
#include <stddef.h> /* For NULL. */
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <sysdep-cancel.h>
+#endif
#include "sigset-cvt-mask.h"
@@ -43,6 +46,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)
@@ -54,5 +60,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
}