xref: /dragonfly/sys/sys/_pthreadtypes.h (revision a09695ba)
1 /*
2  * Copyright (c) 2020 The DragonFly Project.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
16  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
17  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
21  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
23  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  */
26 
27 #ifndef _SYS__PTHREADTYPES_H_
28 #define	_SYS__PTHREADTYPES_H_
29 
30 #include <sys/cdefs.h>
31 
32 /*
33  * Forward opaque structure definitions that do not pollute namespaces.
34  * To be used in headers where visibility is an issue.
35  */
36 struct __pthread_s;
37 struct __pthread_attr_s;
38 struct __pthread_barrier_s;
39 struct __pthread_barrierattr_s;
40 struct __pthread_cond_s;
41 struct __pthread_condattr_s;
42 struct __pthread_mutex_s;
43 struct __pthread_mutexattr_s;
44 struct __pthread_once_s;
45 struct __pthread_rwlock_s;
46 struct __pthread_rwlockattr_s;
47 struct __pthread_spinlock_s;
48 
49 /*
50  * Basic pthread types to be used in function prototypes.
51  */
52 #ifndef _PTHREAD_T_DECLARED
53 typedef	struct __pthread_s		*pthread_t;
54 #define	_PTHREAD_T_DECLARED
55 #endif
56 #ifndef _PTHREAD_ATTR_T_DECLARED
57 typedef	struct __pthread_attr_s		*pthread_attr_t;
58 #define	_PTHREAD_ATTR_T_DECLARED
59 #endif
60 typedef	struct __pthread_barrier_s	*pthread_barrier_t;
61 typedef	struct __pthread_barrierattr_s	*pthread_barrierattr_t;
62 typedef	struct __pthread_cond_s		*pthread_cond_t;
63 typedef	struct __pthread_condattr_s	*pthread_condattr_t;
64 typedef	struct __pthread_mutex_s	*pthread_mutex_t;
65 typedef	struct __pthread_mutexattr_s	*pthread_mutexattr_t;
66 typedef	int				pthread_key_t;
67 typedef	struct __pthread_once_s		pthread_once_t;
68 
69 typedef	struct __pthread_rwlock_s	*pthread_rwlock_t;
70 typedef	struct __pthread_rwlockattr_s	*pthread_rwlockattr_t;
71 typedef	struct __pthread_spinlock_s	*pthread_spinlock_t;
72 
73 /*
74  * Once-only structure (partly public).
75  */
76 struct __pthread_once_s {
77 	int		__state;
78 	void		*__sparelibc_r;	/* unused, kept for ABI compat */
79 };
80 
81 #endif	/* !_SYS__PTHREADTYPES_H_ */
82