thr_sigwait.c (62181) | thr_sigwait.c (67097) |
---|---|
1/* 2 * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * | 1/* 2 * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * |
32 * $FreeBSD: head/lib/libkse/thread/thr_sigwait.c 62181 2000-06-27 21:30:16Z jasone $ | 32 * $FreeBSD: head/lib/libkse/thread/thr_sigwait.c 67097 2000-10-13 22:12:32Z deischen $ |
33 */ 34#include <signal.h> 35#include <sys/param.h> 36#include <sys/signalvar.h> 37#include <errno.h> 38#ifdef _THREAD_SAFE 39#include <pthread.h> 40#include "pthread_private.h" 41 42int | 33 */ 34#include <signal.h> 35#include <sys/param.h> 36#include <sys/signalvar.h> 37#include <errno.h> 38#ifdef _THREAD_SAFE 39#include <pthread.h> 40#include "pthread_private.h" 41 42int |
43sigwait(const sigset_t * set, int *sig) | 43sigwait(const sigset_t *set, int *sig) |
44{ 45 int ret = 0; 46 int i; 47 sigset_t tempset, waitset; 48 struct sigaction act; 49 50 _thread_enter_cancellation_point(); 51 /* 52 * Specify the thread kernel signal handler. 53 */ 54 act.sa_handler = (void (*) ()) _thread_sig_handler; | 44{ 45 int ret = 0; 46 int i; 47 sigset_t tempset, waitset; 48 struct sigaction act; 49 50 _thread_enter_cancellation_point(); 51 /* 52 * Specify the thread kernel signal handler. 53 */ 54 act.sa_handler = (void (*) ()) _thread_sig_handler; |
55 act.sa_flags = SA_RESTART; 56 act.sa_mask = *set; | 55 act.sa_flags = SA_RESTART | SA_SIGINFO; 56 /* Ensure the signal handler cannot be interrupted by other signals: */ 57 sigfillset(&act.sa_mask); |
57 | 58 |
58 /* Ensure the scheduling signal is masked: */ 59 sigaddset(&act.sa_mask, _SCHED_SIGNAL); 60 | |
61 /* 62 * Initialize the set of signals that will be waited on: 63 */ 64 waitset = *set; 65 66 /* These signals can't be waited on. */ 67 sigdelset(&waitset, SIGKILL); 68 sigdelset(&waitset, SIGSTOP); --- 105 unchanged lines hidden --- | 59 /* 60 * Initialize the set of signals that will be waited on: 61 */ 62 waitset = *set; 63 64 /* These signals can't be waited on. */ 65 sigdelset(&waitset, SIGKILL); 66 sigdelset(&waitset, SIGSTOP); --- 105 unchanged lines hidden --- |