1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _LIBNSL_INCLUDE_MT_H 28 #define _LIBNSL_INCLUDE_MT_H 29 30 /* 31 * Threading and mutual exclusion declarations of primitives used for 32 * MT operation of libnsl code. 33 * 34 * Note: These primitives are designed to achieve the effect of avoiding a 35 * deadlock possibility by an interface operation being called from 36 * a signal handler while holding a lock. 37 * Note: the sig_*() functions use the _sigoff() and _sigon() consolidation 38 * private interfaces provided by libc to defer all asynchronously 39 * generated signals for the duration of holding the lock. Unlike 40 * blocking all signals with sigprocmask() or thr_sigsetmask(), 41 * _sigoff() allows signals with default dispositions to exercise 42 * their default actions (killing the process, stopping the process). 43 */ 44 45 #include <thread.h> 46 #include <pthread.h> 47 #include <signal.h> 48 #include <synch.h> 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 54 extern sigset_t fillset; /* for actually blocking all signals */ 55 56 extern void sig_mutex_lock(mutex_t *); 57 extern void sig_mutex_unlock(mutex_t *); 58 extern void sig_rw_rdlock(rwlock_t *); 59 extern void sig_rw_wrlock(rwlock_t *); 60 extern void sig_rw_unlock(rwlock_t *); 61 62 extern void _sigoff(void); 63 extern void _sigon(void); 64 65 extern void *thr_get_storage(pthread_key_t *, size_t, void(*)(void *)); 66 67 #ifdef __cplusplus 68 } 69 #endif 70 71 #endif /* _LIBNSL_INCLUDE_MT_H */ 72