xref: /freebsd-src/include/pthread.h (revision 220aa0f450409948b869237e5c4505f992c913ce)
1e58eb3c4SPedro F. Giffuni /*-
2e58eb3c4SPedro F. Giffuni  * SPDX-License-Identifier: BSD-4-Clause
3e58eb3c4SPedro F. Giffuni  *
42c2eb193SJulian Elischer  * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu
5edb4b26fSJohn Birrell  * Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au>
62c2eb193SJulian Elischer  * All rights reserved.
72c2eb193SJulian Elischer  *
82c2eb193SJulian Elischer  * Redistribution and use in source and binary forms, with or without
92c2eb193SJulian Elischer  * modification, are permitted provided that the following conditions
102c2eb193SJulian Elischer  * are met:
112c2eb193SJulian Elischer  * 1. Redistributions of source code must retain the above copyright
122c2eb193SJulian Elischer  *    notice, this list of conditions and the following disclaimer.
132c2eb193SJulian Elischer  * 2. Redistributions in binary form must reproduce the above copyright
142c2eb193SJulian Elischer  *    notice, this list of conditions and the following disclaimer in the
152c2eb193SJulian Elischer  *    documentation and/or other materials provided with the distribution.
162c2eb193SJulian Elischer  * 3. All advertising materials mentioning features or use of this software
172c2eb193SJulian Elischer  *    must display the following acknowledgement:
182c2eb193SJulian Elischer  *  This product includes software developed by Chris Provenzano.
192c2eb193SJulian Elischer  * 4. The name of Chris Provenzano may not be used to endorse or promote
202c2eb193SJulian Elischer  *	  products derived from this software without specific prior written
212c2eb193SJulian Elischer  *	  permission.
222c2eb193SJulian Elischer  *
232c2eb193SJulian Elischer  * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
242c2eb193SJulian Elischer  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
252c2eb193SJulian Elischer  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
262c2eb193SJulian Elischer  * ARE DISCLAIMED.  IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
272c2eb193SJulian Elischer  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
282c2eb193SJulian Elischer  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
292c2eb193SJulian Elischer  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
302c2eb193SJulian Elischer  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
312c2eb193SJulian Elischer  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
322c2eb193SJulian Elischer  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
332c2eb193SJulian Elischer  * SUCH DAMAGE.
342c2eb193SJulian Elischer  */
352c2eb193SJulian Elischer #ifndef _PTHREAD_H_
362c2eb193SJulian Elischer #define	_PTHREAD_H_
372c2eb193SJulian Elischer 
382c2eb193SJulian Elischer /*
392c2eb193SJulian Elischer  * Header files.
402c2eb193SJulian Elischer  */
412c2eb193SJulian Elischer #include <sys/cdefs.h>
424d62f529SCraig Rodrigues #include <sys/_pthreadtypes.h>
43323abbb7SStefan Farfeleder #include <machine/_limits.h>
449bb8a409SAlex Richardson #include <sys/_types.h>
45323abbb7SStefan Farfeleder #include <sys/_sigset.h>
46*220aa0f4SKonstantin Belousov #if __BSD_VISIBLE
47*220aa0f4SKonstantin Belousov #include <sys/_sigval.h>
48*220aa0f4SKonstantin Belousov #endif
49b847980fSJohn Birrell #include <sched.h>
50323abbb7SStefan Farfeleder #include <time.h>
512c2eb193SJulian Elischer 
522c2eb193SJulian Elischer /*
530f7d6847SJulian Elischer  * Run-time invariant values:
540f7d6847SJulian Elischer  */
550f7d6847SJulian Elischer #define	PTHREAD_DESTRUCTOR_ITERATIONS		4
560f7d6847SJulian Elischer #define	PTHREAD_KEYS_MAX			256
57323abbb7SStefan Farfeleder #define	PTHREAD_STACK_MIN			__MINSIGSTKSZ
58323abbb7SStefan Farfeleder #define	PTHREAD_THREADS_MAX			__ULONG_MAX
592ab83179SDavid Xu #define	PTHREAD_BARRIER_SERIAL_THREAD		-1
600f7d6847SJulian Elischer 
610f7d6847SJulian Elischer /*
62c840cec7SJulian Elischer  * Flags for threads and thread attributes.
63c840cec7SJulian Elischer  */
64c840cec7SJulian Elischer #define	PTHREAD_DETACHED		0x1
65c840cec7SJulian Elischer #define	PTHREAD_SCOPE_SYSTEM		0x2
66c840cec7SJulian Elischer #define	PTHREAD_INHERIT_SCHED		0x4
67c840cec7SJulian Elischer #define	PTHREAD_NOFLOAT			0x8
68c840cec7SJulian Elischer 
69c840cec7SJulian Elischer #define	PTHREAD_CREATE_DETACHED		PTHREAD_DETACHED
70c840cec7SJulian Elischer #define	PTHREAD_CREATE_JOINABLE		0
71c840cec7SJulian Elischer #define	PTHREAD_SCOPE_PROCESS		0
72c840cec7SJulian Elischer #define	PTHREAD_EXPLICIT_SCHED		0
73c840cec7SJulian Elischer 
74c840cec7SJulian Elischer /*
751bdbd705SKonstantin Belousov  * Values for process shared/private attributes.
76c0e36632SAlexander Langer  */
77c0e36632SAlexander Langer #define	PTHREAD_PROCESS_PRIVATE		0
78c0e36632SAlexander Langer #define	PTHREAD_PROCESS_SHARED		1
79c0e36632SAlexander Langer 
80c0e36632SAlexander Langer /*
817285bccfSAlfred Perlstein  * Flags for cancelling threads
827285bccfSAlfred Perlstein  */
837285bccfSAlfred Perlstein #define	PTHREAD_CANCEL_ENABLE		0
847285bccfSAlfred Perlstein #define	PTHREAD_CANCEL_DISABLE		1
857285bccfSAlfred Perlstein #define	PTHREAD_CANCEL_DEFERRED		0
867285bccfSAlfred Perlstein #define	PTHREAD_CANCEL_ASYNCHRONOUS	2
877285bccfSAlfred Perlstein #define	PTHREAD_CANCELED		((void *) 1)
887285bccfSAlfred Perlstein 
897285bccfSAlfred Perlstein /*
902c2eb193SJulian Elischer  * Flags for once initialization.
912c2eb193SJulian Elischer  */
922c2eb193SJulian Elischer #define	PTHREAD_NEEDS_INIT	0
932c2eb193SJulian Elischer #define	PTHREAD_DONE_INIT	1
942c2eb193SJulian Elischer 
952c2eb193SJulian Elischer /*
962c2eb193SJulian Elischer  * Static once initialization values.
972c2eb193SJulian Elischer  */
980f7d6847SJulian Elischer #define	PTHREAD_ONCE_INIT	{ PTHREAD_NEEDS_INIT, NULL }
992c2eb193SJulian Elischer 
1002c2eb193SJulian Elischer /*
101edb4b26fSJohn Birrell  * Static initialization values.
102edb4b26fSJohn Birrell  */
103edb4b26fSJohn Birrell #define	PTHREAD_MUTEX_INITIALIZER	NULL
104bbb64c21SDavid Xu #define	PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP	((pthread_mutex_t)1)
105edb4b26fSJohn Birrell #define	PTHREAD_COND_INITIALIZER	NULL
106c0e36632SAlexander Langer #define	PTHREAD_RWLOCK_INITIALIZER	NULL
107edb4b26fSJohn Birrell 
108edb4b26fSJohn Birrell /*
109edb4b26fSJohn Birrell  * Default attribute arguments (draft 4, deprecated).
1102c2eb193SJulian Elischer  */
1112c2eb193SJulian Elischer #ifndef PTHREAD_KERNEL
112c840cec7SJulian Elischer #define	pthread_condattr_default	NULL
1139362f73dSJeffrey Hsu #define	pthread_mutexattr_default	NULL
1142c2eb193SJulian Elischer #define	pthread_attr_default		NULL
1152c2eb193SJulian Elischer #endif
1162c2eb193SJulian Elischer 
117b847980fSJohn Birrell #define	PTHREAD_PRIO_NONE	0
118b847980fSJohn Birrell #define	PTHREAD_PRIO_INHERIT	1
119b847980fSJohn Birrell #define	PTHREAD_PRIO_PROTECT	2
120b847980fSJohn Birrell 
121b847980fSJohn Birrell /*
122b847980fSJohn Birrell  * Mutex types (Single UNIX Specification, Version 2, 1997).
123b847980fSJohn Birrell  *
124b847980fSJohn Birrell  * Note that a mutex attribute with one of the following types:
125b847980fSJohn Birrell  *
126b847980fSJohn Birrell  *	PTHREAD_MUTEX_NORMAL
127b847980fSJohn Birrell  *	PTHREAD_MUTEX_RECURSIVE
128b847980fSJohn Birrell  *
129b847980fSJohn Birrell  * will deviate from POSIX specified semantics.
130b847980fSJohn Birrell  */
1319362f73dSJeffrey Hsu enum pthread_mutextype {
132b847980fSJohn Birrell 	PTHREAD_MUTEX_ERRORCHECK	= 1,	/* Default POSIX mutex */
133b847980fSJohn Birrell 	PTHREAD_MUTEX_RECURSIVE		= 2,	/* Recursive mutex */
134b847980fSJohn Birrell 	PTHREAD_MUTEX_NORMAL		= 3,	/* No error checking */
1352017a7cdSKris Kennaway 	PTHREAD_MUTEX_ADAPTIVE_NP	= 4,	/* Adaptive mutex, spins briefly before blocking on lock */
136ad7c4916SStefan Farfeleder 	PTHREAD_MUTEX_TYPE_MAX
1379362f73dSJeffrey Hsu };
1389362f73dSJeffrey Hsu 
139b847980fSJohn Birrell #define	PTHREAD_MUTEX_DEFAULT		PTHREAD_MUTEX_ERRORCHECK
14007bab7c6SEivind Eklund 
1412a339d9eSKonstantin Belousov #define	PTHREAD_MUTEX_STALLED		0
1422a339d9eSKonstantin Belousov #define	PTHREAD_MUTEX_ROBUST		1
1432a339d9eSKonstantin Belousov 
14483a07587SDavid Xu struct _pthread_cleanup_info {
14583a07587SDavid Xu 	__uintptr_t	pthread_cleanup_pad[8];
14683a07587SDavid Xu };
14783a07587SDavid Xu 
1482c2eb193SJulian Elischer /*
1492c2eb193SJulian Elischer  * Thread function prototype definitions:
1502c2eb193SJulian Elischer  */
1512c2eb193SJulian Elischer __BEGIN_DECLS
1526ee81d6fSStefan Farfeleder int		pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
1537a07ca9bSPedro F. Giffuni int		pthread_attr_destroy(pthread_attr_t *);
154649702c5SPedro F. Giffuni int		pthread_attr_getstack(
1557a07ca9bSPedro F. Giffuni 		    const pthread_attr_t * __restrict, void ** __restrict,
1567a07ca9bSPedro F. Giffuni 		    size_t * __restrict);
157b6413b6dSPedro F. Giffuni int		pthread_attr_getstacksize(const pthread_attr_t * __restrict,
158b6413b6dSPedro F. Giffuni 		    size_t * __restrict);
159b6413b6dSPedro F. Giffuni int		pthread_attr_getguardsize(const pthread_attr_t * __restrict,
160b6413b6dSPedro F. Giffuni 		    size_t * __restrict);
161bb28f3c2SWarner Losh int		pthread_attr_getstackaddr(const pthread_attr_t *, void **);
1627a07ca9bSPedro F. Giffuni int		pthread_attr_getdetachstate(const pthread_attr_t *,
1637a07ca9bSPedro F. Giffuni 		    int *);
1647a07ca9bSPedro F. Giffuni int		pthread_attr_init(pthread_attr_t *);
1657a07ca9bSPedro F. Giffuni int		pthread_attr_setstacksize(pthread_attr_t *, size_t);
1667a07ca9bSPedro F. Giffuni int		pthread_attr_setguardsize(pthread_attr_t *, size_t);
1677a07ca9bSPedro F. Giffuni int		pthread_attr_setstack(pthread_attr_t *, void *,
168649702c5SPedro F. Giffuni 		    size_t);
169bb28f3c2SWarner Losh int		pthread_attr_setstackaddr(pthread_attr_t *, void *);
1707a07ca9bSPedro F. Giffuni int		pthread_attr_setdetachstate(pthread_attr_t *, int);
1717a07ca9bSPedro F. Giffuni int		pthread_barrier_destroy(pthread_barrier_t *);
172b6413b6dSPedro F. Giffuni int		pthread_barrier_init(pthread_barrier_t * __restrict,
173b6413b6dSPedro F. Giffuni 			const pthread_barrierattr_t * __restrict, unsigned);
1747a07ca9bSPedro F. Giffuni int		pthread_barrier_wait(pthread_barrier_t *);
1757a07ca9bSPedro F. Giffuni int		pthread_barrierattr_destroy(pthread_barrierattr_t *);
176649702c5SPedro F. Giffuni int		pthread_barrierattr_getpshared(
177b6413b6dSPedro F. Giffuni 		    const pthread_barrierattr_t * __restrict, int * __restrict);
1787a07ca9bSPedro F. Giffuni int		pthread_barrierattr_init(pthread_barrierattr_t *);
17965436b2eSPedro F. Giffuni int		pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
18083a07587SDavid Xu 
18183a07587SDavid Xu #define		pthread_cleanup_push(cleanup_routine, cleanup_arg)		\
18283a07587SDavid Xu 		{								\
18383a07587SDavid Xu 			struct _pthread_cleanup_info __cleanup_info__;		\
18483a07587SDavid Xu 			__pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\
18583a07587SDavid Xu 				&__cleanup_info__);				\
18683a07587SDavid Xu 			{
18783a07587SDavid Xu 
18883a07587SDavid Xu #define		pthread_cleanup_pop(execute)					\
18923bbf7faSTijl Coosemans 				(void)0;					\
19083a07587SDavid Xu 			}							\
19183a07587SDavid Xu 			__pthread_cleanup_pop_imp(execute);			\
19283a07587SDavid Xu 		}
19383a07587SDavid Xu 
1947a07ca9bSPedro F. Giffuni int		pthread_condattr_destroy(pthread_condattr_t *);
195b6413b6dSPedro F. Giffuni int		pthread_condattr_getclock(const pthread_condattr_t * __restrict,
196b6413b6dSPedro F. Giffuni 		    clockid_t * __restrict);
19765436b2eSPedro F. Giffuni int		pthread_condattr_getpshared(const pthread_condattr_t *, int *);
1987a07ca9bSPedro F. Giffuni int		pthread_condattr_init(pthread_condattr_t *);
19965436b2eSPedro F. Giffuni int		pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
2007a07ca9bSPedro F. Giffuni int		pthread_condattr_setpshared(pthread_condattr_t *, int);
2017a07ca9bSPedro F. Giffuni int		pthread_cond_broadcast(pthread_cond_t *);
2027a07ca9bSPedro F. Giffuni int		pthread_cond_destroy(pthread_cond_t *);
203b6413b6dSPedro F. Giffuni int		pthread_cond_init(pthread_cond_t * __restrict,
204b6413b6dSPedro F. Giffuni 		    const pthread_condattr_t * __restrict);
2057a07ca9bSPedro F. Giffuni int		pthread_cond_signal(pthread_cond_t *);
2067a07ca9bSPedro F. Giffuni int		pthread_cond_timedwait(pthread_cond_t *,
2077a07ca9bSPedro F. Giffuni 		    pthread_mutex_t * __mutex,
2087a07ca9bSPedro F. Giffuni 		    const struct timespec *)
209f1b298adSPedro F. Giffuni 		    __requires_exclusive(*__mutex);
210b6413b6dSPedro F. Giffuni int		pthread_cond_wait(pthread_cond_t * __restrict,
211b6413b6dSPedro F. Giffuni 		    pthread_mutex_t * __restrict __mutex)
212f1b298adSPedro F. Giffuni 		    __requires_exclusive(*__mutex);
213b6413b6dSPedro F. Giffuni int		pthread_create(pthread_t * __restrict,
214b6413b6dSPedro F. Giffuni 		    const pthread_attr_t * __restrict, void *(*) (void *),
215b6413b6dSPedro F. Giffuni 		    void * __restrict);
216bb28f3c2SWarner Losh int		pthread_detach(pthread_t);
217bb28f3c2SWarner Losh int		pthread_equal(pthread_t, pthread_t);
218bb28f3c2SWarner Losh void		pthread_exit(void *) __dead2;
219bb28f3c2SWarner Losh void		*pthread_getspecific(pthread_key_t);
2207a07ca9bSPedro F. Giffuni int		pthread_getcpuclockid(pthread_t, clockid_t *);
221bb28f3c2SWarner Losh int		pthread_join(pthread_t, void **);
22265436b2eSPedro F. Giffuni int		pthread_key_create(pthread_key_t *, void (*) (void *));
223bb28f3c2SWarner Losh int		pthread_key_delete(pthread_key_t);
2247a07ca9bSPedro F. Giffuni int		pthread_mutexattr_init(pthread_mutexattr_t *);
2257a07ca9bSPedro F. Giffuni int		pthread_mutexattr_destroy(pthread_mutexattr_t *);
226b6413b6dSPedro F. Giffuni int		pthread_mutexattr_getpshared(
227b6413b6dSPedro F. Giffuni 		    const pthread_mutexattr_t * __restrict,
228b6413b6dSPedro F. Giffuni 		    int * __restrict);
229b6413b6dSPedro F. Giffuni int		pthread_mutexattr_gettype(
230b6413b6dSPedro F. Giffuni 		    const pthread_mutexattr_t * __restrict, int * __restrict);
2317a07ca9bSPedro F. Giffuni int		pthread_mutexattr_settype(pthread_mutexattr_t *, int);
23265436b2eSPedro F. Giffuni int		pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
2337a07ca9bSPedro F. Giffuni int		pthread_mutex_consistent(pthread_mutex_t * __mutex)
234649702c5SPedro F. Giffuni 		    __requires_exclusive(*__mutex);
2357a07ca9bSPedro F. Giffuni int		pthread_mutex_destroy(pthread_mutex_t * __mutex)
236f1b298adSPedro F. Giffuni 		    __requires_unlocked(*__mutex);
237b6413b6dSPedro F. Giffuni int		pthread_mutex_init(pthread_mutex_t * __restrict __mutex,
238b6413b6dSPedro F. Giffuni 		    const pthread_mutexattr_t * __restrict)
239f1b298adSPedro F. Giffuni 		    __requires_unlocked(*__mutex);
2407a07ca9bSPedro F. Giffuni int		pthread_mutex_lock(pthread_mutex_t * __mutex)
241f1b298adSPedro F. Giffuni 		    __locks_exclusive(*__mutex);
2427a07ca9bSPedro F. Giffuni int		pthread_mutex_trylock(pthread_mutex_t * __mutex)
243f1b298adSPedro F. Giffuni 		    __trylocks_exclusive(0, *__mutex);
244b6413b6dSPedro F. Giffuni int		pthread_mutex_timedlock(pthread_mutex_t * __restrict __mutex,
245b6413b6dSPedro F. Giffuni 		    const struct timespec * __restrict)
246f1b298adSPedro F. Giffuni 		    __trylocks_exclusive(0, *__mutex);
2477a07ca9bSPedro F. Giffuni int		pthread_mutex_unlock(pthread_mutex_t * __mutex)
248f1b298adSPedro F. Giffuni 		    __unlocks(*__mutex);
24965436b2eSPedro F. Giffuni int		pthread_once(pthread_once_t *, void (*) (void));
2507a07ca9bSPedro F. Giffuni int		pthread_rwlock_destroy(pthread_rwlock_t * __rwlock)
251f1b298adSPedro F. Giffuni 		    __requires_unlocked(*__rwlock);
252b6413b6dSPedro F. Giffuni int		pthread_rwlock_init(pthread_rwlock_t * __restrict __rwlock,
253b6413b6dSPedro F. Giffuni 		    const pthread_rwlockattr_t * __restrict)
254f1b298adSPedro F. Giffuni 		    __requires_unlocked(*__rwlock);
2557a07ca9bSPedro F. Giffuni int		pthread_rwlock_rdlock(pthread_rwlock_t * __rwlock)
256f1b298adSPedro F. Giffuni 		    __locks_shared(*__rwlock);
257b6413b6dSPedro F. Giffuni int		pthread_rwlock_timedrdlock(
258b6413b6dSPedro F. Giffuni 		    pthread_rwlock_t * __restrict __rwlock,
259b6413b6dSPedro F. Giffuni 		    const struct timespec * __restrict)
260f1b298adSPedro F. Giffuni 		    __trylocks_shared(0, *__rwlock);
261b6413b6dSPedro F. Giffuni int		pthread_rwlock_timedwrlock(
262b6413b6dSPedro F. Giffuni 		    pthread_rwlock_t * __restrict __rwlock,
263b6413b6dSPedro F. Giffuni 		    const struct timespec * __restrict)
264f1b298adSPedro F. Giffuni 		    __trylocks_exclusive(0, *__rwlock);
2657a07ca9bSPedro F. Giffuni int		pthread_rwlock_tryrdlock(pthread_rwlock_t * __rwlock)
266f1b298adSPedro F. Giffuni 		    __trylocks_shared(0, *__rwlock);
2677a07ca9bSPedro F. Giffuni int		pthread_rwlock_trywrlock(pthread_rwlock_t * __rwlock)
268f1b298adSPedro F. Giffuni 		    __trylocks_exclusive(0, *__rwlock);
2697a07ca9bSPedro F. Giffuni int		pthread_rwlock_unlock(pthread_rwlock_t * __rwlock)
270f1b298adSPedro F. Giffuni 		    __unlocks(*__rwlock);
2717a07ca9bSPedro F. Giffuni int		pthread_rwlock_wrlock(pthread_rwlock_t * __rwlock)
272f1b298adSPedro F. Giffuni 		    __locks_exclusive(*__rwlock);
2737a07ca9bSPedro F. Giffuni int		pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
27465436b2eSPedro F. Giffuni int		pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *,
27565436b2eSPedro F. Giffuni 		    int *);
276b6413b6dSPedro F. Giffuni int		pthread_rwlockattr_getpshared(
277b6413b6dSPedro F. Giffuni 		    const pthread_rwlockattr_t * __restrict,
278b6413b6dSPedro F. Giffuni 		    int * __restrict);
2797a07ca9bSPedro F. Giffuni int		pthread_rwlockattr_init(pthread_rwlockattr_t *);
2807a07ca9bSPedro F. Giffuni int		pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *,
281649702c5SPedro F. Giffuni 		    int);
28265436b2eSPedro F. Giffuni int		pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
283bb28f3c2SWarner Losh pthread_t	pthread_self(void);
284bb28f3c2SWarner Losh int		pthread_setspecific(pthread_key_t, const void *);
2850f7d6847SJulian Elischer 
2867a07ca9bSPedro F. Giffuni int		pthread_spin_init(pthread_spinlock_t * __spin, int)
28749891e45SEd Schouten 		    __requires_unlocked(*__spin);
2887a07ca9bSPedro F. Giffuni int		pthread_spin_destroy(pthread_spinlock_t * __spin)
28949891e45SEd Schouten 		    __requires_unlocked(*__spin);
2907a07ca9bSPedro F. Giffuni int		pthread_spin_lock(pthread_spinlock_t * __spin)
29149891e45SEd Schouten 			__locks_exclusive(*__spin);
2927a07ca9bSPedro F. Giffuni int		pthread_spin_trylock(pthread_spinlock_t * __spin)
29349891e45SEd Schouten 			__trylocks_exclusive(0, *__spin);
2947a07ca9bSPedro F. Giffuni int		pthread_spin_unlock(pthread_spinlock_t * __spin)
29549891e45SEd Schouten 			__unlocks(*__spin);
296bb28f3c2SWarner Losh int		pthread_cancel(pthread_t);
297bb28f3c2SWarner Losh int		pthread_setcancelstate(int, int *);
298bb28f3c2SWarner Losh int		pthread_setcanceltype(int, int *);
299bb28f3c2SWarner Losh void		pthread_testcancel(void);
3000f7d6847SJulian Elischer 
30148a3f7d9SDavid Schultz #if __BSD_VISIBLE
302bb28f3c2SWarner Losh int		pthread_getprio(pthread_t);
303bb28f3c2SWarner Losh int		pthread_setprio(pthread_t, int);
304bb28f3c2SWarner Losh void		pthread_yield(void);
3052ef84b7dSKonstantin Belousov 
3062ef84b7dSKonstantin Belousov int		pthread_getname_np(pthread_t, char *, size_t);
3072ef84b7dSKonstantin Belousov int		pthread_setname_np(pthread_t, const char *);
308*220aa0f4SKonstantin Belousov 
309*220aa0f4SKonstantin Belousov int		pthread_sigqueue(pthread_t thread, int sig,
310*220aa0f4SKonstantin Belousov 		    const union sigval value);
311*220aa0f4SKonstantin Belousov 
31248a3f7d9SDavid Schultz #endif
313b847980fSJohn Birrell 
314b6413b6dSPedro F. Giffuni int		pthread_mutexattr_getprioceiling(
315b6413b6dSPedro F. Giffuni 		    const pthread_mutexattr_t * __restrict,
316b6413b6dSPedro F. Giffuni 		    int * __restrict);
317649702c5SPedro F. Giffuni int		pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
318b6413b6dSPedro F. Giffuni int		pthread_mutex_getprioceiling(const pthread_mutex_t * __restrict,
319b6413b6dSPedro F. Giffuni 		    int * __restrict);
320b6413b6dSPedro F. Giffuni int		pthread_mutex_setprioceiling(pthread_mutex_t * __restrict, int,
321b6413b6dSPedro F. Giffuni 		    int * __restrict);
322b847980fSJohn Birrell 
323b6413b6dSPedro F. Giffuni int		pthread_mutexattr_getprotocol(
324b6413b6dSPedro F. Giffuni 		    const pthread_mutexattr_t * __restrict,
325b6413b6dSPedro F. Giffuni 		    int * __restrict);
326bb28f3c2SWarner Losh int		pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
327b847980fSJohn Birrell 
328649702c5SPedro F. Giffuni int		pthread_mutexattr_getrobust(
3297a07ca9bSPedro F. Giffuni 		    pthread_mutexattr_t * __restrict, int * __restrict);
33065436b2eSPedro F. Giffuni int		pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
3312a339d9eSKonstantin Belousov 
332b6413b6dSPedro F. Giffuni int		pthread_attr_getinheritsched(const pthread_attr_t * __restrict,
333b6413b6dSPedro F. Giffuni 		    int * __restrict);
3347a07ca9bSPedro F. Giffuni int		pthread_attr_getschedparam(const pthread_attr_t *,
3357a07ca9bSPedro F. Giffuni 		    struct sched_param *);
336b6413b6dSPedro F. Giffuni int		pthread_attr_getschedpolicy(const pthread_attr_t * __restrict,
337b6413b6dSPedro F. Giffuni 		    int * __restrict);
338b6413b6dSPedro F. Giffuni int		pthread_attr_getscope(const pthread_attr_t * __restrict,
339b6413b6dSPedro F. Giffuni 		    int * __restrict);
340bb28f3c2SWarner Losh int		pthread_attr_setinheritsched(pthread_attr_t *, int);
3417a07ca9bSPedro F. Giffuni int		pthread_attr_setschedparam(pthread_attr_t *,
3427a07ca9bSPedro F. Giffuni 		    const struct sched_param *);
3437a07ca9bSPedro F. Giffuni int		pthread_attr_setschedpolicy(pthread_attr_t *, int);
3447a07ca9bSPedro F. Giffuni int		pthread_attr_setscope(pthread_attr_t *, int);
345b6413b6dSPedro F. Giffuni int		pthread_getschedparam(pthread_t pthread, int * __restrict,
346b6413b6dSPedro F. Giffuni 		    struct sched_param * __restrict);
347bb28f3c2SWarner Losh int		pthread_setschedparam(pthread_t, int,
3487a07ca9bSPedro F. Giffuni 		    const struct sched_param *);
34948a3f7d9SDavid Schultz #if __XSI_VISIBLE
3508c0d4b5fSJohn Polstra int		pthread_getconcurrency(void);
3518c0d4b5fSJohn Polstra int		pthread_setconcurrency(int);
35248a3f7d9SDavid Schultz #endif
35383a07587SDavid Xu 
35483a07587SDavid Xu void		__pthread_cleanup_push_imp(void (*)(void *), void *,
35583a07587SDavid Xu 			struct _pthread_cleanup_info *);
35683a07587SDavid Xu void		__pthread_cleanup_pop_imp(int);
3572c2eb193SJulian Elischer __END_DECLS
3582c2eb193SJulian Elischer 
3594eecef90SPedro F. Giffuni #endif	/* !_PTHREAD_H_ */
360