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