diff options
Diffstat (limited to 'man3/pthread_sigmask.3')
-rw-r--r-- | man3/pthread_sigmask.3 | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/man3/pthread_sigmask.3 b/man3/pthread_sigmask.3 index f91b6d365..b4c912e49 100644 --- a/man3/pthread_sigmask.3 +++ b/man3/pthread_sigmask.3 @@ -105,18 +105,18 @@ Signal handling thread got signal 10 #include <stdio.h> #include <stdlib.h> #include <unistd.h> - +\& /* Simple error handling functions */ - +\& #define handle_error_en(en, msg) \e do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) - +\& static void * sig_thread(void *arg) { sigset_t *set = arg; int s, sig; - +\& for (;;) { s = sigwait(set, &sig); if (s != 0) @@ -124,31 +124,31 @@ sig_thread(void *arg) printf("Signal handling thread got signal %d\en", sig); } } - +\& int main(void) { pthread_t thread; sigset_t set; int s; - +\& /* Block SIGQUIT and SIGUSR1; other threads created by main() will inherit a copy of the signal mask. */ - +\& sigemptyset(&set); sigaddset(&set, SIGQUIT); sigaddset(&set, SIGUSR1); s = pthread_sigmask(SIG_BLOCK, &set, NULL); if (s != 0) handle_error_en(s, "pthread_sigmask"); - +\& s = pthread_create(&thread, NULL, &sig_thread, &set); if (s != 0) handle_error_en(s, "pthread_create"); - +\& /* Main thread carries on to create other threads and/or do other work. */ - +\& pause(); /* Dummy pause so we can test program */ } .EE |