thr_sigsuspend.c (117300) | thr_sigsuspend.c (117706) |
---|---|
1/* 2 * Copyright (c) 1995 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 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_sigsuspend.c 117300 2003-07-07 04:28:23Z davidxu $ | 32 * $FreeBSD: head/lib/libkse/thread/thr_sigsuspend.c 117706 2003-07-17 23:02:30Z davidxu $ |
33 */ 34#include <signal.h> 35#include <errno.h> 36#include <pthread.h> 37#include <string.h> | 33 */ 34#include <signal.h> 35#include <errno.h> 36#include <pthread.h> 37#include <string.h> |
38#include <sys/signalvar.h> |
|
38#include "thr_private.h" 39 40__weak_reference(__sigsuspend, sigsuspend); 41 42int 43_sigsuspend(const sigset_t *set) 44{ 45 struct pthread *curthread = _get_curthread(); 46 sigset_t oldmask, newmask; 47 int ret = -1; 48 | 39#include "thr_private.h" 40 41__weak_reference(__sigsuspend, sigsuspend); 42 43int 44_sigsuspend(const sigset_t *set) 45{ 46 struct pthread *curthread = _get_curthread(); 47 sigset_t oldmask, newmask; 48 int ret = -1; 49 |
49 if (!_kse_isthreaded()) 50 return __sys_sigsuspend(set); | 50 if (!_kse_isthreaded() || 51 (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)) 52 return (__sys_sigsuspend(set)); |
51 52 /* Check if a new signal set was provided by the caller: */ 53 if (set != NULL) { 54 newmask = *set; | 53 54 /* Check if a new signal set was provided by the caller: */ 55 if (set != NULL) { 56 newmask = *set; |
57 SIG_CANTMASK(newmask); |
|
55 56 THR_LOCK_SWITCH(curthread); 57 58 /* Save current sigmask */ 59 memcpy(&oldmask, &curthread->sigmask, sizeof(sigset_t)); 60 61 /* Change the caller's mask: */ 62 memcpy(&curthread->sigmask, &newmask, sizeof(sigset_t)); --- 39 unchanged lines hidden --- | 58 59 THR_LOCK_SWITCH(curthread); 60 61 /* Save current sigmask */ 62 memcpy(&oldmask, &curthread->sigmask, sizeof(sigset_t)); 63 64 /* Change the caller's mask: */ 65 memcpy(&curthread->sigmask, &newmask, sizeof(sigset_t)); --- 39 unchanged lines hidden --- |