thr_sig.c (50476) | thr_sig.c (51794) |
---|---|
1/* 2 * Copyright (c) 1995-1998 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) 1995-1998 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_sig.c 50476 1999-08-28 00:22:10Z peter $ | 32 * $FreeBSD: head/lib/libkse/thread/thr_sig.c 51794 1999-09-29 15:18:46Z marcel $ |
33 */ | 33 */ |
34#include <sys/param.h> 35#include <sys/types.h> 36#include <sys/signalvar.h> |
|
34#include <signal.h> 35#include <fcntl.h> 36#include <unistd.h> 37#include <errno.h> 38#ifdef _THREAD_SAFE 39#include <pthread.h> 40#include "pthread_private.h" 41 --- 15 unchanged lines hidden (view full) --- 57 handled_sigs[i - 1] = 0; 58 } 59 60 /* Clear the lock: */ 61 signal_lock.access_lock = 0; 62} 63 64void | 37#include <signal.h> 38#include <fcntl.h> 39#include <unistd.h> 40#include <errno.h> 41#ifdef _THREAD_SAFE 42#include <pthread.h> 43#include "pthread_private.h" 44 --- 15 unchanged lines hidden (view full) --- 60 handled_sigs[i - 1] = 0; 61 } 62 63 /* Clear the lock: */ 64 signal_lock.access_lock = 0; 65} 66 67void |
65_thread_sig_handler(int sig, int code, struct sigcontext * scp) | 68_thread_sig_handler(int sig, int code, ucontext_t * scp) |
66{ 67 char c; 68 int i; 69 70 /* Check if an interval timer signal: */ 71 if (sig == _SCHED_SIGNAL) { 72 if (_thread_kern_in_sched != 0) { 73 /* --- 69 unchanged lines hidden (view full) --- 143 _thread_sig_handle(i, scp); 144 } 145 signal_lock.access_lock = 0; 146 } 147 } 148} 149 150void | 69{ 70 char c; 71 int i; 72 73 /* Check if an interval timer signal: */ 74 if (sig == _SCHED_SIGNAL) { 75 if (_thread_kern_in_sched != 0) { 76 /* --- 69 unchanged lines hidden (view full) --- 146 _thread_sig_handle(i, scp); 147 } 148 signal_lock.access_lock = 0; 149 } 150 } 151} 152 153void |
151_thread_sig_handle(int sig, struct sigcontext * scp) | 154_thread_sig_handle(int sig, ucontext_t * scp) |
152{ 153 int i; 154 pthread_t pthread, pthread_next; 155 156 /* Check if the signal requires a dump of thread information: */ 157 if (sig == SIGINFO) 158 /* Dump thread information to file: */ 159 _thread_dump_info(); --- 195 unchanged lines hidden (view full) --- 355 break; 356 } 357} 358 359/* Dispatch pending signals to the running thread: */ 360void 361_dispatch_signals() 362{ | 155{ 156 int i; 157 pthread_t pthread, pthread_next; 158 159 /* Check if the signal requires a dump of thread information: */ 160 if (sig == SIGINFO) 161 /* Dump thread information to file: */ 162 _thread_dump_info(); --- 195 unchanged lines hidden (view full) --- 358 break; 359 } 360} 361 362/* Dispatch pending signals to the running thread: */ 363void 364_dispatch_signals() 365{ |
366 sigset_t sigset; |
|
363 int i; 364 365 /* 366 * Check if there are pending signals for the running 367 * thread that aren't blocked: 368 */ | 367 int i; 368 369 /* 370 * Check if there are pending signals for the running 371 * thread that aren't blocked: 372 */ |
369 if ((_thread_run->sigpend & ~_thread_run->sigmask) != 0) | 373 sigset = _thread_run->sigpend; 374 SIGSETNAND(sigset, _thread_run->sigmask); 375 if (SIGNOTEMPTY(sigset)) |
370 /* Look for all possible pending signals: */ 371 for (i = 1; i < NSIG; i++) 372 /* 373 * Check that a custom handler is installed 374 * and if the signal is not blocked: 375 */ 376 if (_thread_sigact[i - 1].sa_handler != SIG_DFL && 377 _thread_sigact[i - 1].sa_handler != SIG_IGN && --- 13 unchanged lines hidden --- | 376 /* Look for all possible pending signals: */ 377 for (i = 1; i < NSIG; i++) 378 /* 379 * Check that a custom handler is installed 380 * and if the signal is not blocked: 381 */ 382 if (_thread_sigact[i - 1].sa_handler != SIG_DFL && 383 _thread_sigact[i - 1].sa_handler != SIG_IGN && --- 13 unchanged lines hidden --- |