thr_sig.c (114254) | thr_sig.c (114664) |
---|---|
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 114254 2003-04-29 21:03:33Z deischen $ | 32 * $FreeBSD: head/lib/libkse/thread/thr_sig.c 114664 2003-05-04 16:17:01Z deischen $ |
33 */ 34#include <sys/param.h> 35#include <sys/types.h> 36#include <sys/signalvar.h> 37#include <signal.h> 38#include <errno.h> 39#include <fcntl.h> 40#include <unistd.h> --- 270 unchanged lines hidden (view full) --- 311 */ 312 KSE_LOCK_RELEASE(curkse, &_thread_list_lock); 313 DBG_MSG("Waking thread %p in sigwait with signal %d\n", 314 pthread, sig); 315 return (NULL); 316 } 317 else if ((pthread->state == PS_DEAD) || 318 (pthread->state == PS_DEADLOCK) || | 33 */ 34#include <sys/param.h> 35#include <sys/types.h> 36#include <sys/signalvar.h> 37#include <signal.h> 38#include <errno.h> 39#include <fcntl.h> 40#include <unistd.h> --- 270 unchanged lines hidden (view full) --- 311 */ 312 KSE_LOCK_RELEASE(curkse, &_thread_list_lock); 313 DBG_MSG("Waking thread %p in sigwait with signal %d\n", 314 pthread, sig); 315 return (NULL); 316 } 317 else if ((pthread->state == PS_DEAD) || 318 (pthread->state == PS_DEADLOCK) || |
319 ((pthread->flags & THR_FLAGS_EXITING) != 0)) | 319 THR_IS_EXITING(pthread) || THR_IS_SUSPENDED(pthread)) |
320 ; /* Skip this thread. */ 321 else if ((handler_installed != 0) && | 320 ; /* Skip this thread. */ 321 else if ((handler_installed != 0) && |
322 !sigismember(&pthread->tmbx.tm_context.uc_sigmask, sig) && 323 ((pthread->flags & THR_FLAGS_SUSPENDED) == 0)) { | 322 !sigismember(&pthread->tmbx.tm_context.uc_sigmask, sig)) { |
324 if (pthread->state == PS_SIGSUSPEND) { 325 if (suspended_thread == NULL) 326 suspended_thread = pthread; 327 } else if (signaled_thread == NULL) 328 signaled_thread = pthread; 329 } 330 KSE_SCHED_UNLOCK(curkse, pthread->kseg); 331 } --- 373 unchanged lines hidden (view full) --- 705 * place the thread in the run queue. It is also 706 * possible for a signal to be sent to a suspended 707 * thread, mostly via pthread_kill(). If a thread 708 * is suspended, don't insert it into the priority 709 * queue; just set its state to suspended and it 710 * will run the signal handler when it is resumed. 711 */ 712 pthread->active_priority |= THR_SIGNAL_PRIORITY; | 323 if (pthread->state == PS_SIGSUSPEND) { 324 if (suspended_thread == NULL) 325 suspended_thread = pthread; 326 } else if (signaled_thread == NULL) 327 signaled_thread = pthread; 328 } 329 KSE_SCHED_UNLOCK(curkse, pthread->kseg); 330 } --- 373 unchanged lines hidden (view full) --- 704 * place the thread in the run queue. It is also 705 * possible for a signal to be sent to a suspended 706 * thread, mostly via pthread_kill(). If a thread 707 * is suspended, don't insert it into the priority 708 * queue; just set its state to suspended and it 709 * will run the signal handler when it is resumed. 710 */ 711 pthread->active_priority |= THR_SIGNAL_PRIORITY; |
713 if ((pthread->flags & THR_FLAGS_SUSPENDED) != 0) 714 THR_SET_STATE(pthread, PS_SUSPENDED); 715 else if ((pthread->flags & THR_FLAGS_IN_RUNQ) == 0) | 712 if ((pthread->flags & THR_FLAGS_IN_RUNQ) == 0) |
716 THR_RUNQ_INSERT_TAIL(pthread); 717 } 718} 719 720static void 721thr_sig_check_state(struct pthread *pthread, int sig) 722{ 723 /* --- 178 unchanged lines hidden --- | 713 THR_RUNQ_INSERT_TAIL(pthread); 714 } 715} 716 717static void 718thr_sig_check_state(struct pthread *pthread, int sig) 719{ 720 /* --- 178 unchanged lines hidden --- |