xref: /illumos-gate/usr/src/head/pthread.h (revision ba3594ba)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5cb620785Sraf  * Common Development and Distribution License (the "License").
6cb620785Sraf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21cb620785Sraf 
227c478bd9Sstevel@tonic-gate /*
23*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24*ba3594baSGarrett D'Amore  *
251e2ea07cSRoger A. Faulkner  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifndef _PTHREAD_H
307c478bd9Sstevel@tonic-gate #define	_PTHREAD_H
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef	_ASM
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate #include <time.h>
377c478bd9Sstevel@tonic-gate #include <sched.h>
387c478bd9Sstevel@tonic-gate #endif	/* _ASM */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
417c478bd9Sstevel@tonic-gate extern "C" {
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * Thread related attribute values defined as in thread.h.
467c478bd9Sstevel@tonic-gate  * These are defined as bit pattern in thread.h.
477c478bd9Sstevel@tonic-gate  * Any change here should be reflected in thread.h.
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate /* detach */
507c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_DETACHED		0x40	/* = THR_DETACHED */
517c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_JOINABLE		0
527c478bd9Sstevel@tonic-gate /* scope */
537c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_SYSTEM		0x01	/* = THR_BOUND */
547c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_PROCESS		0
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate /*
577c478bd9Sstevel@tonic-gate  * Other attributes which are not defined in thread.h
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate /* inherit */
607c478bd9Sstevel@tonic-gate #define	PTHREAD_INHERIT_SCHED		1
617c478bd9Sstevel@tonic-gate #define	PTHREAD_EXPLICIT_SCHED		0
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * Value of process-shared attribute
657c478bd9Sstevel@tonic-gate  * These are defined as values defined in sys/synch.h
667c478bd9Sstevel@tonic-gate  * Any change here should be reflected in sys/synch.h.
677c478bd9Sstevel@tonic-gate  */
687c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_SHARED		1	/* = USYNC_PROCESS */
697c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_PRIVATE		0	/* = USYNC_THREAD */
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #define	_DEFAULT_TYPE 			PTHREAD_PROCESS_PRIVATE
727c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
737c478bd9Sstevel@tonic-gate #define	DEFAULT_TYPE			_DEFAULT_TYPE
747c478bd9Sstevel@tonic-gate #endif
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate /*
777c478bd9Sstevel@tonic-gate  * mutex types
787c478bd9Sstevel@tonic-gate  * keep these in synch which sys/synch.h lock flags
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_NORMAL		0x0
817c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_ERRORCHECK	0x2
827c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_RECURSIVE		0x4
837c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_DEFAULT		PTHREAD_MUTEX_NORMAL
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate /*
867c478bd9Sstevel@tonic-gate  * Mutex protocol values. Keep these in synch with sys/synch.h lock types.
877c478bd9Sstevel@tonic-gate  */
887c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_NONE		0x0
897c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_INHERIT		0x10
907c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_PROTECT		0x20
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate /*
9380d89c86SRoger A. Faulkner  * Mutex robust attribute values.
9480d89c86SRoger A. Faulkner  * Keep these in synch with sys/synch.h lock types.
957c478bd9Sstevel@tonic-gate  */
9680d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_STALLED		0x0
9780d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_ROBUST		0x40
9880d89c86SRoger A. Faulkner /*
9980d89c86SRoger A. Faulkner  * Historical solaris-specific names,
10080d89c86SRoger A. Faulkner  * from before pthread_mutexattr_getrobust() became standardized
10180d89c86SRoger A. Faulkner  */
10280d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_STALL_NP		PTHREAD_MUTEX_STALLED
10380d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_ROBUST_NP		PTHREAD_MUTEX_ROBUST
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate /*
1067c478bd9Sstevel@tonic-gate  * macros - default initializers defined as in synch.h
1077c478bd9Sstevel@tonic-gate  * Any change here should be reflected in synch.h.
1087c478bd9Sstevel@tonic-gate  *
1097c478bd9Sstevel@tonic-gate  * NOTE:
1107c478bd9Sstevel@tonic-gate  * Make sure that any change in the macros is consistent with the definition
1117c478bd9Sstevel@tonic-gate  * of the corresponding types in sys/types.h (e.g. PTHREAD_MUTEX_INITIALIZER
1127c478bd9Sstevel@tonic-gate  * should be consistent with the definition for pthread_mutex_t).
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_INITIALIZER		/* = DEFAULTMUTEX */	\
1157c478bd9Sstevel@tonic-gate 	{{0, 0, 0, _DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate #define	PTHREAD_COND_INITIALIZER		/* = DEFAULTCV */	\
1187c478bd9Sstevel@tonic-gate 	{{{0, 0, 0, 0}, _DEFAULT_TYPE, _COND_MAGIC}, 0}
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate #define	PTHREAD_RWLOCK_INITIALIZER		/* = DEFAULTRWLOCK */	\
1217c478bd9Sstevel@tonic-gate 	{0, _DEFAULT_TYPE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER,	\
1227c478bd9Sstevel@tonic-gate 	PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER}
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate /* cancellation type and state */
1257c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ENABLE		0x00
1267c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DISABLE		0x01
1277c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DEFERRED		0x00
1287c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ASYNCHRONOUS	0x02
1297c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCELED		(void *)-19
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate /* pthread_once related values */
1327c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_NOTDONE	0
1337c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_DONE	1
1341e2ea07cSRoger A. Faulkner #define	PTHREAD_ONCE_INIT	{ {0, 0, 0, PTHREAD_ONCE_NOTDONE} }
1357c478bd9Sstevel@tonic-gate 
136cb620785Sraf /*
137cb620785Sraf  * The key to be created by pthread_key_create_once_np()
138cb620785Sraf  * must be statically initialized with PTHREAD_ONCE_KEY_NP.
139cb620785Sraf  * This must be the same as THR_ONCE_KEY in <thread.h>
140cb620785Sraf  */
141cb620785Sraf #define	PTHREAD_ONCE_KEY_NP	(pthread_key_t)(-1)
142cb620785Sraf 
1437c478bd9Sstevel@tonic-gate /* barriers */
1447c478bd9Sstevel@tonic-gate #define	PTHREAD_BARRIER_SERIAL_THREAD	-2
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate #ifndef	_ASM
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate /*
1497c478bd9Sstevel@tonic-gate  * cancellation cleanup structure
1507c478bd9Sstevel@tonic-gate  */
1517c478bd9Sstevel@tonic-gate typedef struct _cleanup {
1527c478bd9Sstevel@tonic-gate 	uintptr_t	pthread_cleanup_pad[4];
1537c478bd9Sstevel@tonic-gate } _cleanup_t;
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate void	__pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *);
1567c478bd9Sstevel@tonic-gate void	__pthread_cleanup_pop(int, _cleanup_t *);
1577c478bd9Sstevel@tonic-gate caddr_t	_getfp(void);
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate #if __cplusplus
1607c478bd9Sstevel@tonic-gate extern "C" {
1617c478bd9Sstevel@tonic-gate #endif
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #if __cplusplus
1667c478bd9Sstevel@tonic-gate } /* extern "C" */
1677c478bd9Sstevel@tonic-gate #endif
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate #define	pthread_cleanup_push(routine, args) { \
1707c478bd9Sstevel@tonic-gate 	_cleanup_t _cleanup_info; \
1717c478bd9Sstevel@tonic-gate 	__pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \
1727c478bd9Sstevel@tonic-gate 				(caddr_t)_getfp(), &_cleanup_info);
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate #define	pthread_cleanup_pop(ex) \
1757c478bd9Sstevel@tonic-gate 	__pthread_cleanup_pop(ex, &_cleanup_info); \
1767c478bd9Sstevel@tonic-gate }
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate /*
1797c478bd9Sstevel@tonic-gate  * function prototypes - thread related calls
1807c478bd9Sstevel@tonic-gate  */
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate /*
1837c478bd9Sstevel@tonic-gate  * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The
1847c478bd9Sstevel@tonic-gate  * declarations are identical. A change to either one may also require
1857c478bd9Sstevel@tonic-gate  * appropriate namespace updates in order to avoid redeclaration
1867c478bd9Sstevel@tonic-gate  * warnings in the case where both prototypes are exposed via inclusion
1877c478bd9Sstevel@tonic-gate  * of both <pthread.h> and <unistd.h>.
1887c478bd9Sstevel@tonic-gate  */
1897c478bd9Sstevel@tonic-gate extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
1907c478bd9Sstevel@tonic-gate extern int pthread_attr_init(pthread_attr_t *);
1917c478bd9Sstevel@tonic-gate extern int pthread_attr_destroy(pthread_attr_t *);
1927c478bd9Sstevel@tonic-gate extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
1937c478bd9Sstevel@tonic-gate extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD,
1947c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD);
1957c478bd9Sstevel@tonic-gate extern int pthread_attr_setstacksize(pthread_attr_t *, size_t);
1967c478bd9Sstevel@tonic-gate extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD,
1977c478bd9Sstevel@tonic-gate 		size_t *_RESTRICT_KYWD);
1987c478bd9Sstevel@tonic-gate extern int pthread_attr_setstackaddr(pthread_attr_t *, void *);
1997c478bd9Sstevel@tonic-gate extern int pthread_attr_getstackaddr(const pthread_attr_t *_RESTRICT_KYWD,
2007c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD);
2017c478bd9Sstevel@tonic-gate extern int pthread_attr_setdetachstate(pthread_attr_t *, int);
2027c478bd9Sstevel@tonic-gate extern int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
2037c478bd9Sstevel@tonic-gate extern int pthread_attr_setscope(pthread_attr_t *, int);
2047c478bd9Sstevel@tonic-gate extern int pthread_attr_getscope(const pthread_attr_t *_RESTRICT_KYWD,
2057c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2067c478bd9Sstevel@tonic-gate extern int pthread_attr_setinheritsched(pthread_attr_t *, int);
2077c478bd9Sstevel@tonic-gate extern int pthread_attr_getinheritsched(const pthread_attr_t *_RESTRICT_KYWD,
2087c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2097c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedpolicy(pthread_attr_t *, int);
2107c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedpolicy(const pthread_attr_t *_RESTRICT_KYWD,
2117c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2127c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedparam(pthread_attr_t *_RESTRICT_KYWD,
2137c478bd9Sstevel@tonic-gate 		const struct sched_param *_RESTRICT_KYWD);
2147c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedparam(const pthread_attr_t *_RESTRICT_KYWD,
2157c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
2167c478bd9Sstevel@tonic-gate extern int pthread_create(pthread_t *_RESTRICT_KYWD,
2177c478bd9Sstevel@tonic-gate 		const pthread_attr_t *_RESTRICT_KYWD, void * (*)(void *),
2187c478bd9Sstevel@tonic-gate 		void *_RESTRICT_KYWD);
2197c478bd9Sstevel@tonic-gate extern int pthread_once(pthread_once_t *, void (*)(void));
2207c478bd9Sstevel@tonic-gate extern int pthread_join(pthread_t, void **);
2217c478bd9Sstevel@tonic-gate extern int pthread_detach(pthread_t);
2227c478bd9Sstevel@tonic-gate extern void pthread_exit(void *) __NORETURN;
2237c478bd9Sstevel@tonic-gate extern int pthread_cancel(pthread_t);
2247c478bd9Sstevel@tonic-gate extern int pthread_setschedparam(pthread_t, int, const struct sched_param *);
2257c478bd9Sstevel@tonic-gate extern int pthread_getschedparam(pthread_t, int *_RESTRICT_KYWD,
2267c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
2277c478bd9Sstevel@tonic-gate extern int pthread_setschedprio(pthread_t, int);
2287c478bd9Sstevel@tonic-gate extern int pthread_setcancelstate(int, int *);
2297c478bd9Sstevel@tonic-gate extern int pthread_setcanceltype(int, int *);
2307c478bd9Sstevel@tonic-gate extern void pthread_testcancel(void);
2317c478bd9Sstevel@tonic-gate extern int pthread_equal(pthread_t, pthread_t);
2327c478bd9Sstevel@tonic-gate extern int pthread_key_create(pthread_key_t *, void (*)(void *));
233cb620785Sraf extern int pthread_key_create_once_np(pthread_key_t *, void (*)(void *));
2347c478bd9Sstevel@tonic-gate extern int pthread_key_delete(pthread_key_t);
2357c478bd9Sstevel@tonic-gate extern int pthread_setspecific(pthread_key_t, const void *);
2367c478bd9Sstevel@tonic-gate extern void *pthread_getspecific(pthread_key_t);
2377c478bd9Sstevel@tonic-gate extern pthread_t pthread_self(void);
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate /*
2407c478bd9Sstevel@tonic-gate  * function prototypes - synchronization related calls
2417c478bd9Sstevel@tonic-gate  */
2427c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_init(pthread_mutexattr_t *);
2437c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_destroy(pthread_mutexattr_t *);
2447c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
2457c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getpshared(
2467c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2477c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
2487c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol(
2497c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2507c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
2517c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling(
2527c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
25380d89c86SRoger A. Faulkner extern int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
25480d89c86SRoger A. Faulkner extern int pthread_mutexattr_getrobust(
2557c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2567c478bd9Sstevel@tonic-gate extern int pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD,
2577c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD);
25880d89c86SRoger A. Faulkner extern int pthread_mutex_consistent(pthread_mutex_t *);
2597c478bd9Sstevel@tonic-gate extern int pthread_mutex_destroy(pthread_mutex_t *);
2607c478bd9Sstevel@tonic-gate extern int pthread_mutex_lock(pthread_mutex_t *);
2617c478bd9Sstevel@tonic-gate extern int pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD,
2627c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2637c478bd9Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np(pthread_mutex_t *_RESTRICT_KYWD,
2647c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2657c478bd9Sstevel@tonic-gate extern int pthread_mutex_unlock(pthread_mutex_t *);
2667c478bd9Sstevel@tonic-gate extern int pthread_mutex_trylock(pthread_mutex_t *);
2677c478bd9Sstevel@tonic-gate extern int pthread_mutex_setprioceiling(pthread_mutex_t *_RESTRICT_KYWD,
2687c478bd9Sstevel@tonic-gate 	int, int *_RESTRICT_KYWD);
2697c478bd9Sstevel@tonic-gate extern int pthread_mutex_getprioceiling(const pthread_mutex_t *_RESTRICT_KYWD,
2707c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2717c478bd9Sstevel@tonic-gate extern int pthread_condattr_init(pthread_condattr_t *);
2727c478bd9Sstevel@tonic-gate extern int pthread_condattr_destroy(pthread_condattr_t *);
2737c478bd9Sstevel@tonic-gate extern int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
2747c478bd9Sstevel@tonic-gate extern int pthread_condattr_getclock(const pthread_condattr_t *_RESTRICT_KYWD,
2757c478bd9Sstevel@tonic-gate 	clockid_t *_RESTRICT_KYWD);
2767c478bd9Sstevel@tonic-gate extern int pthread_condattr_setpshared(pthread_condattr_t *, int);
2777c478bd9Sstevel@tonic-gate extern int pthread_condattr_getpshared(const pthread_condattr_t *_RESTRICT_KYWD,
2787c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2797c478bd9Sstevel@tonic-gate extern int pthread_cond_init(pthread_cond_t *_RESTRICT_KYWD,
2807c478bd9Sstevel@tonic-gate 	const pthread_condattr_t *_RESTRICT_KYWD);
2817c478bd9Sstevel@tonic-gate extern int pthread_cond_destroy(pthread_cond_t *);
2827c478bd9Sstevel@tonic-gate extern int pthread_cond_broadcast(pthread_cond_t *);
2837c478bd9Sstevel@tonic-gate extern int pthread_cond_signal(pthread_cond_t *);
2847c478bd9Sstevel@tonic-gate extern int pthread_cond_wait(pthread_cond_t *_RESTRICT_KYWD,
2857c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD);
2867c478bd9Sstevel@tonic-gate extern int pthread_cond_timedwait(pthread_cond_t *_RESTRICT_KYWD,
2877c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
2887c478bd9Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np(pthread_cond_t *_RESTRICT_KYWD,
2897c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
2907c478bd9Sstevel@tonic-gate extern int pthread_attr_getguardsize(const pthread_attr_t *_RESTRICT_KYWD,
2917c478bd9Sstevel@tonic-gate 	size_t *_RESTRICT_KYWD);
2927c478bd9Sstevel@tonic-gate extern int pthread_attr_setguardsize(pthread_attr_t *, size_t);
2937c478bd9Sstevel@tonic-gate extern int pthread_getconcurrency(void);
2947c478bd9Sstevel@tonic-gate extern int pthread_setconcurrency(int);
2957c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
2967c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *_RESTRICT_KYWD,
2977c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2987c478bd9Sstevel@tonic-gate extern int pthread_rwlock_init(pthread_rwlock_t *_RESTRICT_KYWD,
2997c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD);
3007c478bd9Sstevel@tonic-gate extern int pthread_rwlock_destroy(pthread_rwlock_t *);
3017c478bd9Sstevel@tonic-gate extern int pthread_rwlock_rdlock(pthread_rwlock_t *);
3027c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *_RESTRICT_KYWD,
3037c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3047c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedrdlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3057c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3067c478bd9Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
3077c478bd9Sstevel@tonic-gate extern int pthread_rwlock_wrlock(pthread_rwlock_t *);
3087c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *_RESTRICT_KYWD,
3097c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3107c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedwrlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3117c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3127c478bd9Sstevel@tonic-gate extern int pthread_rwlock_trywrlock(pthread_rwlock_t *);
3137c478bd9Sstevel@tonic-gate extern int pthread_rwlock_unlock(pthread_rwlock_t *);
3147c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_init(pthread_rwlockattr_t *);
3157c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
3167c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared(
3177c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3187c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
3197c478bd9Sstevel@tonic-gate extern int pthread_spin_init(pthread_spinlock_t *, int);
3207c478bd9Sstevel@tonic-gate extern int pthread_spin_destroy(pthread_spinlock_t *);
3217c478bd9Sstevel@tonic-gate extern int pthread_spin_lock(pthread_spinlock_t *);
3227c478bd9Sstevel@tonic-gate extern int pthread_spin_trylock(pthread_spinlock_t *);
3237c478bd9Sstevel@tonic-gate extern int pthread_spin_unlock(pthread_spinlock_t *);
3247c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_init(pthread_barrierattr_t *);
3257c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_destroy(pthread_barrierattr_t *);
3267c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
3277c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_getpshared(
3287c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3297c478bd9Sstevel@tonic-gate extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD,
3307c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t);
3317c478bd9Sstevel@tonic-gate extern int pthread_barrier_destroy(pthread_barrier_t *);
3327c478bd9Sstevel@tonic-gate extern int pthread_barrier_wait(pthread_barrier_t *);
3337c478bd9Sstevel@tonic-gate 
33480d89c86SRoger A. Faulkner /* Historical names -- present only for binary compatibility */
33580d89c86SRoger A. Faulkner extern int pthread_mutex_consistent_np(pthread_mutex_t *);
33680d89c86SRoger A. Faulkner extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int);
33780d89c86SRoger A. Faulkner extern int pthread_mutexattr_getrobust_np(
33880d89c86SRoger A. Faulkner 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
33980d89c86SRoger A. Faulkner 
3407c478bd9Sstevel@tonic-gate #endif	/* _ASM */
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3437c478bd9Sstevel@tonic-gate }
3447c478bd9Sstevel@tonic-gate #endif
3457c478bd9Sstevel@tonic-gate 
3467c478bd9Sstevel@tonic-gate #endif	/* _PTHREAD_H */
347