From 57e8823548ad6e65d33b2153edeb18fb0edc20e6 Mon Sep 17 00:00:00 2001 From: Austin Foxley Date: Sat, 17 Oct 2009 14:32:36 -0700 Subject: cancellation support for a large amount of the required syscalls Signed-off-by: Austin Foxley --- libc/signal/sigpause.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'libc/signal/sigpause.c') 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 #include /* For NULL. */ -#include +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#include +#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 } -- cgit v1.2.3