xref: /illumos-gate/usr/src/head/pthread.h (revision a90d75b8)
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 /*
23ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24e56998eeSRobert Mustacchi  * Copyright 2016 Joyent, Inc.
25ba3594baSGarrett D'Amore  *
261e2ea07cSRoger A. Faulkner  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _PTHREAD_H
317c478bd9Sstevel@tonic-gate #define	_PTHREAD_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifndef	_ASM
367c478bd9Sstevel@tonic-gate #include <sys/types.h>
377c478bd9Sstevel@tonic-gate #include <time.h>
387c478bd9Sstevel@tonic-gate #include <sched.h>
397c478bd9Sstevel@tonic-gate #endif	/* _ASM */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
427c478bd9Sstevel@tonic-gate extern "C" {
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * Thread related attribute values defined as in thread.h.
477c478bd9Sstevel@tonic-gate  * These are defined as bit pattern in thread.h.
487c478bd9Sstevel@tonic-gate  * Any change here should be reflected in thread.h.
497c478bd9Sstevel@tonic-gate  */
507c478bd9Sstevel@tonic-gate /* detach */
517c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_DETACHED		0x40	/* = THR_DETACHED */
527c478bd9Sstevel@tonic-gate #define	PTHREAD_CREATE_JOINABLE		0
537c478bd9Sstevel@tonic-gate /* scope */
547c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_SYSTEM		0x01	/* = THR_BOUND */
557c478bd9Sstevel@tonic-gate #define	PTHREAD_SCOPE_PROCESS		0
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /*
587c478bd9Sstevel@tonic-gate  * Other attributes which are not defined in thread.h
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate /* inherit */
617c478bd9Sstevel@tonic-gate #define	PTHREAD_INHERIT_SCHED		1
627c478bd9Sstevel@tonic-gate #define	PTHREAD_EXPLICIT_SCHED		0
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * Value of process-shared attribute
667c478bd9Sstevel@tonic-gate  * These are defined as values defined in sys/synch.h
677c478bd9Sstevel@tonic-gate  * Any change here should be reflected in sys/synch.h.
687c478bd9Sstevel@tonic-gate  */
697c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_SHARED		1	/* = USYNC_PROCESS */
707c478bd9Sstevel@tonic-gate #define	PTHREAD_PROCESS_PRIVATE		0	/* = USYNC_THREAD */
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /*
737c478bd9Sstevel@tonic-gate  * mutex types
747c478bd9Sstevel@tonic-gate  * keep these in synch which sys/synch.h lock flags
757c478bd9Sstevel@tonic-gate  */
767c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_NORMAL		0x0
777c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_ERRORCHECK	0x2
787c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_RECURSIVE		0x4
797c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_DEFAULT		PTHREAD_MUTEX_NORMAL
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate /*
827c478bd9Sstevel@tonic-gate  * Mutex protocol values. Keep these in synch with sys/synch.h lock types.
837c478bd9Sstevel@tonic-gate  */
847c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_NONE		0x0
857c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_INHERIT		0x10
867c478bd9Sstevel@tonic-gate #define	PTHREAD_PRIO_PROTECT		0x20
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /*
8980d89c86SRoger A. Faulkner  * Mutex robust attribute values.
9080d89c86SRoger A. Faulkner  * Keep these in synch with sys/synch.h lock types.
917c478bd9Sstevel@tonic-gate  */
9280d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_STALLED		0x0
9380d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_ROBUST		0x40
9480d89c86SRoger A. Faulkner /*
9580d89c86SRoger A. Faulkner  * Historical solaris-specific names,
9680d89c86SRoger A. Faulkner  * from before pthread_mutexattr_getrobust() became standardized
9780d89c86SRoger A. Faulkner  */
9880d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_STALL_NP		PTHREAD_MUTEX_STALLED
9980d89c86SRoger A. Faulkner #define	PTHREAD_MUTEX_ROBUST_NP		PTHREAD_MUTEX_ROBUST
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate /*
1027c478bd9Sstevel@tonic-gate  * macros - default initializers defined as in synch.h
1037c478bd9Sstevel@tonic-gate  * Any change here should be reflected in synch.h.
1047c478bd9Sstevel@tonic-gate  *
1057c478bd9Sstevel@tonic-gate  * NOTE:
1067c478bd9Sstevel@tonic-gate  * Make sure that any change in the macros is consistent with the definition
1077c478bd9Sstevel@tonic-gate  * of the corresponding types in sys/types.h (e.g. PTHREAD_MUTEX_INITIALIZER
1087c478bd9Sstevel@tonic-gate  * should be consistent with the definition for pthread_mutex_t).
1097c478bd9Sstevel@tonic-gate  */
1107c478bd9Sstevel@tonic-gate #define	PTHREAD_MUTEX_INITIALIZER		/* = DEFAULTMUTEX */	\
111*a90d75b8SRichard PALO 	{{0, 0, 0, PTHREAD_PROCESS_PRIVATE, _MUTEX_MAGIC}, {{{0}}}, 0}
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #define	PTHREAD_COND_INITIALIZER		/* = DEFAULTCV */	\
114*a90d75b8SRichard PALO 	{{{0, 0, 0, 0}, PTHREAD_PROCESS_PRIVATE, _COND_MAGIC}, 0}
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate #define	PTHREAD_RWLOCK_INITIALIZER		/* = DEFAULTRWLOCK */	\
117*a90d75b8SRichard PALO 	{0, PTHREAD_PROCESS_PRIVATE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER, \
1187c478bd9Sstevel@tonic-gate 	PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER}
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate /* cancellation type and state */
1217c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ENABLE		0x00
1227c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DISABLE		0x01
1237c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_DEFERRED		0x00
1247c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCEL_ASYNCHRONOUS	0x02
1257c478bd9Sstevel@tonic-gate #define	PTHREAD_CANCELED		(void *)-19
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate /* pthread_once related values */
1287c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_NOTDONE	0
1297c478bd9Sstevel@tonic-gate #define	PTHREAD_ONCE_DONE	1
1301e2ea07cSRoger A. Faulkner #define	PTHREAD_ONCE_INIT	{ {0, 0, 0, PTHREAD_ONCE_NOTDONE} }
1317c478bd9Sstevel@tonic-gate 
132cb620785Sraf /*
133cb620785Sraf  * The key to be created by pthread_key_create_once_np()
134cb620785Sraf  * must be statically initialized with PTHREAD_ONCE_KEY_NP.
135cb620785Sraf  * This must be the same as THR_ONCE_KEY in <thread.h>
136cb620785Sraf  */
137cb620785Sraf #define	PTHREAD_ONCE_KEY_NP	(pthread_key_t)(-1)
138cb620785Sraf 
1397c478bd9Sstevel@tonic-gate /* barriers */
1407c478bd9Sstevel@tonic-gate #define	PTHREAD_BARRIER_SERIAL_THREAD	-2
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate #ifndef	_ASM
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate /*
1457c478bd9Sstevel@tonic-gate  * cancellation cleanup structure
1467c478bd9Sstevel@tonic-gate  */
1477c478bd9Sstevel@tonic-gate typedef struct _cleanup {
1487c478bd9Sstevel@tonic-gate 	uintptr_t	pthread_cleanup_pad[4];
1497c478bd9Sstevel@tonic-gate } _cleanup_t;
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate void	__pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *);
1527c478bd9Sstevel@tonic-gate void	__pthread_cleanup_pop(int, _cleanup_t *);
1537c478bd9Sstevel@tonic-gate caddr_t	_getfp(void);
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate #if __cplusplus
1567c478bd9Sstevel@tonic-gate extern "C" {
1577c478bd9Sstevel@tonic-gate #endif
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate #if __cplusplus
1627c478bd9Sstevel@tonic-gate } /* extern "C" */
1637c478bd9Sstevel@tonic-gate #endif
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #define	pthread_cleanup_push(routine, args) { \
1667c478bd9Sstevel@tonic-gate 	_cleanup_t _cleanup_info; \
1677c478bd9Sstevel@tonic-gate 	__pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \
1687c478bd9Sstevel@tonic-gate 				(caddr_t)_getfp(), &_cleanup_info);
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate #define	pthread_cleanup_pop(ex) \
1717c478bd9Sstevel@tonic-gate 	__pthread_cleanup_pop(ex, &_cleanup_info); \
1727c478bd9Sstevel@tonic-gate }
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate /*
1757c478bd9Sstevel@tonic-gate  * function prototypes - thread related calls
1767c478bd9Sstevel@tonic-gate  */
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate /*
1797c478bd9Sstevel@tonic-gate  * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The
1807c478bd9Sstevel@tonic-gate  * declarations are identical. A change to either one may also require
1817c478bd9Sstevel@tonic-gate  * appropriate namespace updates in order to avoid redeclaration
1827c478bd9Sstevel@tonic-gate  * warnings in the case where both prototypes are exposed via inclusion
1837c478bd9Sstevel@tonic-gate  * of both <pthread.h> and <unistd.h>.
1847c478bd9Sstevel@tonic-gate  */
1857c478bd9Sstevel@tonic-gate extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
1867c478bd9Sstevel@tonic-gate extern int pthread_attr_init(pthread_attr_t *);
1877c478bd9Sstevel@tonic-gate extern int pthread_attr_destroy(pthread_attr_t *);
1887c478bd9Sstevel@tonic-gate extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
1897c478bd9Sstevel@tonic-gate extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD,
1907c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD);
1917c478bd9Sstevel@tonic-gate extern int pthread_attr_setstacksize(pthread_attr_t *, size_t);
1927c478bd9Sstevel@tonic-gate extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD,
1937c478bd9Sstevel@tonic-gate 		size_t *_RESTRICT_KYWD);
1947c478bd9Sstevel@tonic-gate extern int pthread_attr_setstackaddr(pthread_attr_t *, void *);
1957c478bd9Sstevel@tonic-gate extern int pthread_attr_getstackaddr(const pthread_attr_t *_RESTRICT_KYWD,
1967c478bd9Sstevel@tonic-gate 		void **_RESTRICT_KYWD);
1977c478bd9Sstevel@tonic-gate extern int pthread_attr_setdetachstate(pthread_attr_t *, int);
1987c478bd9Sstevel@tonic-gate extern int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
1997c478bd9Sstevel@tonic-gate extern int pthread_attr_setscope(pthread_attr_t *, int);
2007c478bd9Sstevel@tonic-gate extern int pthread_attr_getscope(const pthread_attr_t *_RESTRICT_KYWD,
2017c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2027c478bd9Sstevel@tonic-gate extern int pthread_attr_setinheritsched(pthread_attr_t *, int);
2037c478bd9Sstevel@tonic-gate extern int pthread_attr_getinheritsched(const pthread_attr_t *_RESTRICT_KYWD,
2047c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2057c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedpolicy(pthread_attr_t *, int);
2067c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedpolicy(const pthread_attr_t *_RESTRICT_KYWD,
2077c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2087c478bd9Sstevel@tonic-gate extern int pthread_attr_setschedparam(pthread_attr_t *_RESTRICT_KYWD,
2097c478bd9Sstevel@tonic-gate 		const struct sched_param *_RESTRICT_KYWD);
2107c478bd9Sstevel@tonic-gate extern int pthread_attr_getschedparam(const pthread_attr_t *_RESTRICT_KYWD,
2117c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
2127c478bd9Sstevel@tonic-gate extern int pthread_create(pthread_t *_RESTRICT_KYWD,
2137c478bd9Sstevel@tonic-gate 		const pthread_attr_t *_RESTRICT_KYWD, void * (*)(void *),
2147c478bd9Sstevel@tonic-gate 		void *_RESTRICT_KYWD);
2157c478bd9Sstevel@tonic-gate extern int pthread_once(pthread_once_t *, void (*)(void));
2167c478bd9Sstevel@tonic-gate extern int pthread_join(pthread_t, void **);
2177c478bd9Sstevel@tonic-gate extern int pthread_detach(pthread_t);
2187c478bd9Sstevel@tonic-gate extern void pthread_exit(void *) __NORETURN;
2197c478bd9Sstevel@tonic-gate extern int pthread_cancel(pthread_t);
2207c478bd9Sstevel@tonic-gate extern int pthread_setschedparam(pthread_t, int, const struct sched_param *);
2217c478bd9Sstevel@tonic-gate extern int pthread_getschedparam(pthread_t, int *_RESTRICT_KYWD,
2227c478bd9Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
2237c478bd9Sstevel@tonic-gate extern int pthread_setschedprio(pthread_t, int);
2247c478bd9Sstevel@tonic-gate extern int pthread_setcancelstate(int, int *);
2257c478bd9Sstevel@tonic-gate extern int pthread_setcanceltype(int, int *);
2267c478bd9Sstevel@tonic-gate extern void pthread_testcancel(void);
2277c478bd9Sstevel@tonic-gate extern int pthread_equal(pthread_t, pthread_t);
2287c478bd9Sstevel@tonic-gate extern int pthread_key_create(pthread_key_t *, void (*)(void *));
229cb620785Sraf extern int pthread_key_create_once_np(pthread_key_t *, void (*)(void *));
2307c478bd9Sstevel@tonic-gate extern int pthread_key_delete(pthread_key_t);
2317c478bd9Sstevel@tonic-gate extern int pthread_setspecific(pthread_key_t, const void *);
2327c478bd9Sstevel@tonic-gate extern void *pthread_getspecific(pthread_key_t);
2337c478bd9Sstevel@tonic-gate extern pthread_t pthread_self(void);
2347c478bd9Sstevel@tonic-gate 
2357c478bd9Sstevel@tonic-gate /*
2367c478bd9Sstevel@tonic-gate  * function prototypes - synchronization related calls
2377c478bd9Sstevel@tonic-gate  */
2387c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_init(pthread_mutexattr_t *);
2397c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_destroy(pthread_mutexattr_t *);
2407c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
2417c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getpshared(
2427c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2437c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
2447c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol(
2457c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2467c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
2477c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling(
2487c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
24980d89c86SRoger A. Faulkner extern int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
25080d89c86SRoger A. Faulkner extern int pthread_mutexattr_getrobust(
2517c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2527c478bd9Sstevel@tonic-gate extern int pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD,
2537c478bd9Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD);
25480d89c86SRoger A. Faulkner extern int pthread_mutex_consistent(pthread_mutex_t *);
2557c478bd9Sstevel@tonic-gate extern int pthread_mutex_destroy(pthread_mutex_t *);
2567c478bd9Sstevel@tonic-gate extern int pthread_mutex_lock(pthread_mutex_t *);
2577c478bd9Sstevel@tonic-gate extern int pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD,
2587c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2597c478bd9Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np(pthread_mutex_t *_RESTRICT_KYWD,
2607c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2617c478bd9Sstevel@tonic-gate extern int pthread_mutex_unlock(pthread_mutex_t *);
2627c478bd9Sstevel@tonic-gate extern int pthread_mutex_trylock(pthread_mutex_t *);
2637c478bd9Sstevel@tonic-gate extern int pthread_mutex_setprioceiling(pthread_mutex_t *_RESTRICT_KYWD,
2647c478bd9Sstevel@tonic-gate 	int, int *_RESTRICT_KYWD);
2657c478bd9Sstevel@tonic-gate extern int pthread_mutex_getprioceiling(const pthread_mutex_t *_RESTRICT_KYWD,
2667c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2677c478bd9Sstevel@tonic-gate extern int pthread_condattr_init(pthread_condattr_t *);
2687c478bd9Sstevel@tonic-gate extern int pthread_condattr_destroy(pthread_condattr_t *);
2697c478bd9Sstevel@tonic-gate extern int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
2707c478bd9Sstevel@tonic-gate extern int pthread_condattr_getclock(const pthread_condattr_t *_RESTRICT_KYWD,
2717c478bd9Sstevel@tonic-gate 	clockid_t *_RESTRICT_KYWD);
2727c478bd9Sstevel@tonic-gate extern int pthread_condattr_setpshared(pthread_condattr_t *, int);
2737c478bd9Sstevel@tonic-gate extern int pthread_condattr_getpshared(const pthread_condattr_t *_RESTRICT_KYWD,
2747c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2757c478bd9Sstevel@tonic-gate extern int pthread_cond_init(pthread_cond_t *_RESTRICT_KYWD,
2767c478bd9Sstevel@tonic-gate 	const pthread_condattr_t *_RESTRICT_KYWD);
2777c478bd9Sstevel@tonic-gate extern int pthread_cond_destroy(pthread_cond_t *);
2787c478bd9Sstevel@tonic-gate extern int pthread_cond_broadcast(pthread_cond_t *);
2797c478bd9Sstevel@tonic-gate extern int pthread_cond_signal(pthread_cond_t *);
2807c478bd9Sstevel@tonic-gate extern int pthread_cond_wait(pthread_cond_t *_RESTRICT_KYWD,
2817c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD);
2827c478bd9Sstevel@tonic-gate extern int pthread_cond_timedwait(pthread_cond_t *_RESTRICT_KYWD,
2837c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
2847c478bd9Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np(pthread_cond_t *_RESTRICT_KYWD,
2857c478bd9Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
2867c478bd9Sstevel@tonic-gate extern int pthread_attr_getguardsize(const pthread_attr_t *_RESTRICT_KYWD,
2877c478bd9Sstevel@tonic-gate 	size_t *_RESTRICT_KYWD);
2887c478bd9Sstevel@tonic-gate extern int pthread_attr_setguardsize(pthread_attr_t *, size_t);
2897c478bd9Sstevel@tonic-gate extern int pthread_getconcurrency(void);
2907c478bd9Sstevel@tonic-gate extern int pthread_setconcurrency(int);
2917c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
2927c478bd9Sstevel@tonic-gate extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *_RESTRICT_KYWD,
2937c478bd9Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2947c478bd9Sstevel@tonic-gate extern int pthread_rwlock_init(pthread_rwlock_t *_RESTRICT_KYWD,
2957c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD);
2967c478bd9Sstevel@tonic-gate extern int pthread_rwlock_destroy(pthread_rwlock_t *);
2977c478bd9Sstevel@tonic-gate extern int pthread_rwlock_rdlock(pthread_rwlock_t *);
2987c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *_RESTRICT_KYWD,
2997c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3007c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedrdlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3017c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3027c478bd9Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
3037c478bd9Sstevel@tonic-gate extern int pthread_rwlock_wrlock(pthread_rwlock_t *);
3047c478bd9Sstevel@tonic-gate extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *_RESTRICT_KYWD,
3057c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3067c478bd9Sstevel@tonic-gate extern int pthread_rwlock_reltimedwrlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3077c478bd9Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3087c478bd9Sstevel@tonic-gate extern int pthread_rwlock_trywrlock(pthread_rwlock_t *);
3097c478bd9Sstevel@tonic-gate extern int pthread_rwlock_unlock(pthread_rwlock_t *);
3107c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_init(pthread_rwlockattr_t *);
3117c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
3127c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared(
3137c478bd9Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3147c478bd9Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
3157c478bd9Sstevel@tonic-gate extern int pthread_spin_init(pthread_spinlock_t *, int);
3167c478bd9Sstevel@tonic-gate extern int pthread_spin_destroy(pthread_spinlock_t *);
3177c478bd9Sstevel@tonic-gate extern int pthread_spin_lock(pthread_spinlock_t *);
3187c478bd9Sstevel@tonic-gate extern int pthread_spin_trylock(pthread_spinlock_t *);
3197c478bd9Sstevel@tonic-gate extern int pthread_spin_unlock(pthread_spinlock_t *);
3207c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_init(pthread_barrierattr_t *);
3217c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_destroy(pthread_barrierattr_t *);
3227c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
3237c478bd9Sstevel@tonic-gate extern int pthread_barrierattr_getpshared(
3247c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3257c478bd9Sstevel@tonic-gate extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD,
3267c478bd9Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t);
3277c478bd9Sstevel@tonic-gate extern int pthread_barrier_destroy(pthread_barrier_t *);
3287c478bd9Sstevel@tonic-gate extern int pthread_barrier_wait(pthread_barrier_t *);
3297c478bd9Sstevel@tonic-gate 
33080d89c86SRoger A. Faulkner /* Historical names -- present only for binary compatibility */
33180d89c86SRoger A. Faulkner extern int pthread_mutex_consistent_np(pthread_mutex_t *);
33280d89c86SRoger A. Faulkner extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int);
33380d89c86SRoger A. Faulkner extern int pthread_mutexattr_getrobust_np(
33480d89c86SRoger A. Faulkner 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
33580d89c86SRoger A. Faulkner 
336e56998eeSRobert Mustacchi /*
337e56998eeSRobert Mustacchi  * These are non-standardized extensions that we provide. Their origins are
338e56998eeSRobert Mustacchi  * documented in their manual pages.
339e56998eeSRobert Mustacchi  */
340e56998eeSRobert Mustacchi #if !defined(_STRICT_SYMBOLS) || defined(__EXTENSIONS__)
341e56998eeSRobert Mustacchi extern int pthread_attr_get_np(pthread_t, pthread_attr_t *);
342e56998eeSRobert Mustacchi #endif	/* !_STRICT_SYMBOLS || __EXTENSIONS__ */
343e56998eeSRobert Mustacchi 
3447c478bd9Sstevel@tonic-gate #endif	/* _ASM */
3457c478bd9Sstevel@tonic-gate 
3467c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3477c478bd9Sstevel@tonic-gate }
3487c478bd9Sstevel@tonic-gate #endif
3497c478bd9Sstevel@tonic-gate 
3507c478bd9Sstevel@tonic-gate #endif	/* _PTHREAD_H */
351