diff options
Diffstat (limited to 'lib/libthr/thread/thr_exit.c')
-rw-r--r-- | lib/libthr/thread/thr_exit.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index e6facd9..10581ab 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -34,6 +34,8 @@ #include <stdio.h> #include <stdlib.h> #include <pthread.h> +#include <sys/types.h> +#include <sys/signalvar.h> #include "un-namespace.h" #include "libc_private.h" @@ -58,6 +60,12 @@ _thread_exit(const char *fname, int lineno, const char *msg) void _pthread_exit(void *status) { + _pthread_exit_mask(status, NULL); +} + +void +_pthread_exit_mask(void *status, sigset_t *mask) +{ struct pthread *curthread = _get_curthread(); /* Check if this thread is already in the process of exiting: */ @@ -73,6 +81,17 @@ _pthread_exit(void *status) curthread->cancelling = 1; curthread->cancel_enable = 0; curthread->cancel_async = 0; + curthread->cancel_point = 0; + if (mask != NULL) + __sys_sigprocmask(SIG_SETMASK, mask, NULL); + if (curthread->unblock_sigcancel) { + sigset_t set; + + curthread->unblock_sigcancel = 0; + SIGEMPTYSET(set); + SIGADDSET(set, SIGCANCEL); + __sys_sigprocmask(SIG_UNBLOCK, mask, NULL); + } /* Save the return value: */ curthread->ret = status; |