xref: /onnv-gate/usr/src/head/pthread.h (revision 8036:1a2f63babdcc)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
53864Sraf  * Common Development and Distribution License (the "License").
63864Sraf  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
213864Sraf 
220Sstevel@tonic-gate /*
237625SRoger.Faulkner@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef _PTHREAD_H
280Sstevel@tonic-gate #define	_PTHREAD_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #include <sys/feature_tests.h>
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifndef	_ASM
330Sstevel@tonic-gate #include <sys/types.h>
340Sstevel@tonic-gate #include <time.h>
350Sstevel@tonic-gate #include <sched.h>
360Sstevel@tonic-gate #endif	/* _ASM */
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #ifdef	__cplusplus
390Sstevel@tonic-gate extern "C" {
400Sstevel@tonic-gate #endif
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  * Thread related attribute values defined as in thread.h.
440Sstevel@tonic-gate  * These are defined as bit pattern in thread.h.
450Sstevel@tonic-gate  * Any change here should be reflected in thread.h.
460Sstevel@tonic-gate  */
470Sstevel@tonic-gate /* detach */
480Sstevel@tonic-gate #define	PTHREAD_CREATE_DETACHED		0x40	/* = THR_DETACHED */
490Sstevel@tonic-gate #define	PTHREAD_CREATE_JOINABLE		0
500Sstevel@tonic-gate /* scope */
510Sstevel@tonic-gate #define	PTHREAD_SCOPE_SYSTEM		0x01	/* = THR_BOUND */
520Sstevel@tonic-gate #define	PTHREAD_SCOPE_PROCESS		0
530Sstevel@tonic-gate 
540Sstevel@tonic-gate /*
550Sstevel@tonic-gate  * Other attributes which are not defined in thread.h
560Sstevel@tonic-gate  */
570Sstevel@tonic-gate /* inherit */
580Sstevel@tonic-gate #define	PTHREAD_INHERIT_SCHED		1
590Sstevel@tonic-gate #define	PTHREAD_EXPLICIT_SCHED		0
600Sstevel@tonic-gate 
610Sstevel@tonic-gate /*
620Sstevel@tonic-gate  * Value of process-shared attribute
630Sstevel@tonic-gate  * These are defined as values defined in sys/synch.h
640Sstevel@tonic-gate  * Any change here should be reflected in sys/synch.h.
650Sstevel@tonic-gate  */
660Sstevel@tonic-gate #define	PTHREAD_PROCESS_SHARED		1	/* = USYNC_PROCESS */
670Sstevel@tonic-gate #define	PTHREAD_PROCESS_PRIVATE		0	/* = USYNC_THREAD */
680Sstevel@tonic-gate 
690Sstevel@tonic-gate #define	_DEFAULT_TYPE 			PTHREAD_PROCESS_PRIVATE
700Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
710Sstevel@tonic-gate #define	DEFAULT_TYPE			_DEFAULT_TYPE
720Sstevel@tonic-gate #endif
730Sstevel@tonic-gate 
740Sstevel@tonic-gate /*
750Sstevel@tonic-gate  * mutex types
760Sstevel@tonic-gate  * keep these in synch which sys/synch.h lock flags
770Sstevel@tonic-gate  */
780Sstevel@tonic-gate #define	PTHREAD_MUTEX_NORMAL		0x0
790Sstevel@tonic-gate #define	PTHREAD_MUTEX_ERRORCHECK	0x2
800Sstevel@tonic-gate #define	PTHREAD_MUTEX_RECURSIVE		0x4
810Sstevel@tonic-gate #define	PTHREAD_MUTEX_DEFAULT		PTHREAD_MUTEX_NORMAL
820Sstevel@tonic-gate 
830Sstevel@tonic-gate /*
840Sstevel@tonic-gate  * Mutex protocol values. Keep these in synch with sys/synch.h lock types.
850Sstevel@tonic-gate  */
860Sstevel@tonic-gate #define	PTHREAD_PRIO_NONE		0x0
870Sstevel@tonic-gate #define	PTHREAD_PRIO_INHERIT		0x10
880Sstevel@tonic-gate #define	PTHREAD_PRIO_PROTECT		0x20
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /*
91*8036SRoger.Faulkner@Sun.COM  * Mutex robust attribute values.
92*8036SRoger.Faulkner@Sun.COM  * Keep these in synch with sys/synch.h lock types.
930Sstevel@tonic-gate  */
94*8036SRoger.Faulkner@Sun.COM #define	PTHREAD_MUTEX_STALLED		0x0
95*8036SRoger.Faulkner@Sun.COM #define	PTHREAD_MUTEX_ROBUST		0x40
96*8036SRoger.Faulkner@Sun.COM /*
97*8036SRoger.Faulkner@Sun.COM  * Historical solaris-specific names,
98*8036SRoger.Faulkner@Sun.COM  * from before pthread_mutexattr_getrobust() became standardized
99*8036SRoger.Faulkner@Sun.COM  */
100*8036SRoger.Faulkner@Sun.COM #define	PTHREAD_MUTEX_STALL_NP		PTHREAD_MUTEX_STALLED
101*8036SRoger.Faulkner@Sun.COM #define	PTHREAD_MUTEX_ROBUST_NP		PTHREAD_MUTEX_ROBUST
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate /*
1040Sstevel@tonic-gate  * macros - default initializers defined as in synch.h
1050Sstevel@tonic-gate  * Any change here should be reflected in synch.h.
1060Sstevel@tonic-gate  *
1070Sstevel@tonic-gate  * NOTE:
1080Sstevel@tonic-gate  * Make sure that any change in the macros is consistent with the definition
1090Sstevel@tonic-gate  * of the corresponding types in sys/types.h (e.g. PTHREAD_MUTEX_INITIALIZER
1100Sstevel@tonic-gate  * should be consistent with the definition for pthread_mutex_t).
1110Sstevel@tonic-gate  */
1120Sstevel@tonic-gate #define	PTHREAD_MUTEX_INITIALIZER		/* = DEFAULTMUTEX */	\
1130Sstevel@tonic-gate 	{{0, 0, 0, _DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate #define	PTHREAD_COND_INITIALIZER		/* = DEFAULTCV */	\
1160Sstevel@tonic-gate 	{{{0, 0, 0, 0}, _DEFAULT_TYPE, _COND_MAGIC}, 0}
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate #define	PTHREAD_RWLOCK_INITIALIZER		/* = DEFAULTRWLOCK */	\
1190Sstevel@tonic-gate 	{0, _DEFAULT_TYPE, _RWL_MAGIC, PTHREAD_MUTEX_INITIALIZER,	\
1200Sstevel@tonic-gate 	PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER}
1210Sstevel@tonic-gate 
1220Sstevel@tonic-gate /* cancellation type and state */
1230Sstevel@tonic-gate #define	PTHREAD_CANCEL_ENABLE		0x00
1240Sstevel@tonic-gate #define	PTHREAD_CANCEL_DISABLE		0x01
1250Sstevel@tonic-gate #define	PTHREAD_CANCEL_DEFERRED		0x00
1260Sstevel@tonic-gate #define	PTHREAD_CANCEL_ASYNCHRONOUS	0x02
1270Sstevel@tonic-gate #define	PTHREAD_CANCELED		(void *)-19
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate /* pthread_once related values */
1300Sstevel@tonic-gate #define	PTHREAD_ONCE_NOTDONE	0
1310Sstevel@tonic-gate #define	PTHREAD_ONCE_DONE	1
1327625SRoger.Faulkner@Sun.COM #define	PTHREAD_ONCE_INIT	{ {0, 0, 0, PTHREAD_ONCE_NOTDONE} }
1330Sstevel@tonic-gate 
1343864Sraf /*
1353864Sraf  * The key to be created by pthread_key_create_once_np()
1363864Sraf  * must be statically initialized with PTHREAD_ONCE_KEY_NP.
1373864Sraf  * This must be the same as THR_ONCE_KEY in <thread.h>
1383864Sraf  */
1393864Sraf #define	PTHREAD_ONCE_KEY_NP	(pthread_key_t)(-1)
1403864Sraf 
1410Sstevel@tonic-gate /* barriers */
1420Sstevel@tonic-gate #define	PTHREAD_BARRIER_SERIAL_THREAD	-2
1430Sstevel@tonic-gate 
1440Sstevel@tonic-gate #ifndef	_ASM
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate /*
1470Sstevel@tonic-gate  * cancellation cleanup structure
1480Sstevel@tonic-gate  */
1490Sstevel@tonic-gate typedef struct _cleanup {
1500Sstevel@tonic-gate 	uintptr_t	pthread_cleanup_pad[4];
1510Sstevel@tonic-gate } _cleanup_t;
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate #ifdef	__STDC__
1540Sstevel@tonic-gate 
1550Sstevel@tonic-gate void	__pthread_cleanup_push(void (*)(void *), void *, caddr_t, _cleanup_t *);
1560Sstevel@tonic-gate void	__pthread_cleanup_pop(int, _cleanup_t *);
1570Sstevel@tonic-gate caddr_t	_getfp(void);
1580Sstevel@tonic-gate 
1590Sstevel@tonic-gate #else	/* __STDC__ */
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate void	__pthread_cleanup_push();
1620Sstevel@tonic-gate void	__pthread_cleanup_pop();
1630Sstevel@tonic-gate caddr_t	_getfp();
1640Sstevel@tonic-gate 
1650Sstevel@tonic-gate #endif	/* __STDC__ */
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate #if __cplusplus
1680Sstevel@tonic-gate extern "C" {
1690Sstevel@tonic-gate #endif
1700Sstevel@tonic-gate 
1710Sstevel@tonic-gate typedef void (*_Voidfp)(void*); /* pointer to extern "C" function */
1720Sstevel@tonic-gate 
1730Sstevel@tonic-gate #if __cplusplus
1740Sstevel@tonic-gate } /* extern "C" */
1750Sstevel@tonic-gate #endif
1760Sstevel@tonic-gate 
1770Sstevel@tonic-gate #define	pthread_cleanup_push(routine, args) { \
1780Sstevel@tonic-gate 	_cleanup_t _cleanup_info; \
1790Sstevel@tonic-gate 	__pthread_cleanup_push((_Voidfp)(routine), (void *)(args), \
1800Sstevel@tonic-gate 				(caddr_t)_getfp(), &_cleanup_info);
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate #define	pthread_cleanup_pop(ex) \
1830Sstevel@tonic-gate 	__pthread_cleanup_pop(ex, &_cleanup_info); \
1840Sstevel@tonic-gate }
1850Sstevel@tonic-gate 
1860Sstevel@tonic-gate #ifdef	__STDC__
1870Sstevel@tonic-gate 
1880Sstevel@tonic-gate /*
1890Sstevel@tonic-gate  * function prototypes - thread related calls
1900Sstevel@tonic-gate  */
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate /*
1930Sstevel@tonic-gate  * pthread_atfork() is also declared in <unistd.h> as per SUSv2. The
1940Sstevel@tonic-gate  * declarations are identical. A change to either one may also require
1950Sstevel@tonic-gate  * appropriate namespace updates in order to avoid redeclaration
1960Sstevel@tonic-gate  * warnings in the case where both prototypes are exposed via inclusion
1970Sstevel@tonic-gate  * of both <pthread.h> and <unistd.h>.
1980Sstevel@tonic-gate  */
1990Sstevel@tonic-gate extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
2000Sstevel@tonic-gate extern int pthread_attr_init(pthread_attr_t *);
2010Sstevel@tonic-gate extern int pthread_attr_destroy(pthread_attr_t *);
2020Sstevel@tonic-gate extern int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
2030Sstevel@tonic-gate extern int pthread_attr_getstack(const pthread_attr_t *_RESTRICT_KYWD,
2040Sstevel@tonic-gate 		void **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD);
2050Sstevel@tonic-gate extern int pthread_attr_setstacksize(pthread_attr_t *, size_t);
2060Sstevel@tonic-gate extern int pthread_attr_getstacksize(const pthread_attr_t *_RESTRICT_KYWD,
2070Sstevel@tonic-gate 		size_t *_RESTRICT_KYWD);
2080Sstevel@tonic-gate extern int pthread_attr_setstackaddr(pthread_attr_t *, void *);
2090Sstevel@tonic-gate extern int pthread_attr_getstackaddr(const pthread_attr_t *_RESTRICT_KYWD,
2100Sstevel@tonic-gate 		void **_RESTRICT_KYWD);
2110Sstevel@tonic-gate extern int pthread_attr_setdetachstate(pthread_attr_t *, int);
2120Sstevel@tonic-gate extern int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
2130Sstevel@tonic-gate extern int pthread_attr_setscope(pthread_attr_t *, int);
2140Sstevel@tonic-gate extern int pthread_attr_getscope(const pthread_attr_t *_RESTRICT_KYWD,
2150Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2160Sstevel@tonic-gate extern int pthread_attr_setinheritsched(pthread_attr_t *, int);
2170Sstevel@tonic-gate extern int pthread_attr_getinheritsched(const pthread_attr_t *_RESTRICT_KYWD,
2180Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2190Sstevel@tonic-gate extern int pthread_attr_setschedpolicy(pthread_attr_t *, int);
2200Sstevel@tonic-gate extern int pthread_attr_getschedpolicy(const pthread_attr_t *_RESTRICT_KYWD,
2210Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2220Sstevel@tonic-gate extern int pthread_attr_setschedparam(pthread_attr_t *_RESTRICT_KYWD,
2230Sstevel@tonic-gate 		const struct sched_param *_RESTRICT_KYWD);
2240Sstevel@tonic-gate extern int pthread_attr_getschedparam(const pthread_attr_t *_RESTRICT_KYWD,
2250Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
2260Sstevel@tonic-gate extern int pthread_create(pthread_t *_RESTRICT_KYWD,
2270Sstevel@tonic-gate 		const pthread_attr_t *_RESTRICT_KYWD, void * (*)(void *),
2280Sstevel@tonic-gate 		void *_RESTRICT_KYWD);
2290Sstevel@tonic-gate extern int pthread_once(pthread_once_t *, void (*)(void));
2300Sstevel@tonic-gate extern int pthread_join(pthread_t, void **);
2310Sstevel@tonic-gate extern int pthread_detach(pthread_t);
2320Sstevel@tonic-gate extern void pthread_exit(void *) __NORETURN;
2330Sstevel@tonic-gate extern int pthread_cancel(pthread_t);
2340Sstevel@tonic-gate extern int pthread_setschedparam(pthread_t, int, const struct sched_param *);
2350Sstevel@tonic-gate extern int pthread_getschedparam(pthread_t, int *_RESTRICT_KYWD,
2360Sstevel@tonic-gate 		struct sched_param *_RESTRICT_KYWD);
2370Sstevel@tonic-gate extern int pthread_setschedprio(pthread_t, int);
2380Sstevel@tonic-gate extern int pthread_setcancelstate(int, int *);
2390Sstevel@tonic-gate extern int pthread_setcanceltype(int, int *);
2400Sstevel@tonic-gate extern void pthread_testcancel(void);
2410Sstevel@tonic-gate extern int pthread_equal(pthread_t, pthread_t);
2420Sstevel@tonic-gate extern int pthread_key_create(pthread_key_t *, void (*)(void *));
2433864Sraf extern int pthread_key_create_once_np(pthread_key_t *, void (*)(void *));
2440Sstevel@tonic-gate extern int pthread_key_delete(pthread_key_t);
2450Sstevel@tonic-gate extern int pthread_setspecific(pthread_key_t, const void *);
2460Sstevel@tonic-gate extern void *pthread_getspecific(pthread_key_t);
2470Sstevel@tonic-gate extern pthread_t pthread_self(void);
2480Sstevel@tonic-gate 
2490Sstevel@tonic-gate /*
2500Sstevel@tonic-gate  * function prototypes - synchronization related calls
2510Sstevel@tonic-gate  */
2520Sstevel@tonic-gate extern int pthread_mutexattr_init(pthread_mutexattr_t *);
2530Sstevel@tonic-gate extern int pthread_mutexattr_destroy(pthread_mutexattr_t *);
2540Sstevel@tonic-gate extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
2550Sstevel@tonic-gate extern int pthread_mutexattr_getpshared(
2560Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2570Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
2580Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol(
2590Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2600Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
2610Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling(
2620Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
263*8036SRoger.Faulkner@Sun.COM extern int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
264*8036SRoger.Faulkner@Sun.COM extern int pthread_mutexattr_getrobust(
2650Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
2660Sstevel@tonic-gate extern int pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD,
2670Sstevel@tonic-gate 	const pthread_mutexattr_t *_RESTRICT_KYWD);
268*8036SRoger.Faulkner@Sun.COM extern int pthread_mutex_consistent(pthread_mutex_t *);
2690Sstevel@tonic-gate extern int pthread_mutex_destroy(pthread_mutex_t *);
2700Sstevel@tonic-gate extern int pthread_mutex_lock(pthread_mutex_t *);
2710Sstevel@tonic-gate extern int pthread_mutex_timedlock(pthread_mutex_t *_RESTRICT_KYWD,
2720Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2730Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np(pthread_mutex_t *_RESTRICT_KYWD,
2740Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
2750Sstevel@tonic-gate extern int pthread_mutex_unlock(pthread_mutex_t *);
2760Sstevel@tonic-gate extern int pthread_mutex_trylock(pthread_mutex_t *);
2770Sstevel@tonic-gate extern int pthread_mutex_setprioceiling(pthread_mutex_t *_RESTRICT_KYWD,
2780Sstevel@tonic-gate 	int, int *_RESTRICT_KYWD);
2790Sstevel@tonic-gate extern int pthread_mutex_getprioceiling(const pthread_mutex_t *_RESTRICT_KYWD,
2800Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2810Sstevel@tonic-gate extern int pthread_condattr_init(pthread_condattr_t *);
2820Sstevel@tonic-gate extern int pthread_condattr_destroy(pthread_condattr_t *);
2830Sstevel@tonic-gate extern int pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
2840Sstevel@tonic-gate extern int pthread_condattr_getclock(const pthread_condattr_t *_RESTRICT_KYWD,
2850Sstevel@tonic-gate 	clockid_t *_RESTRICT_KYWD);
2860Sstevel@tonic-gate extern int pthread_condattr_setpshared(pthread_condattr_t *, int);
2870Sstevel@tonic-gate extern int pthread_condattr_getpshared(const pthread_condattr_t *_RESTRICT_KYWD,
2880Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
2890Sstevel@tonic-gate extern int pthread_cond_init(pthread_cond_t *_RESTRICT_KYWD,
2900Sstevel@tonic-gate 	const pthread_condattr_t *_RESTRICT_KYWD);
2910Sstevel@tonic-gate extern int pthread_cond_destroy(pthread_cond_t *);
2920Sstevel@tonic-gate extern int pthread_cond_broadcast(pthread_cond_t *);
2930Sstevel@tonic-gate extern int pthread_cond_signal(pthread_cond_t *);
2940Sstevel@tonic-gate extern int pthread_cond_wait(pthread_cond_t *_RESTRICT_KYWD,
2950Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD);
2960Sstevel@tonic-gate extern int pthread_cond_timedwait(pthread_cond_t *_RESTRICT_KYWD,
2970Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
2980Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np(pthread_cond_t *_RESTRICT_KYWD,
2990Sstevel@tonic-gate 	pthread_mutex_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
3000Sstevel@tonic-gate extern int pthread_attr_getguardsize(const pthread_attr_t *_RESTRICT_KYWD,
3010Sstevel@tonic-gate 	size_t *_RESTRICT_KYWD);
3020Sstevel@tonic-gate extern int pthread_attr_setguardsize(pthread_attr_t *, size_t);
3030Sstevel@tonic-gate extern int pthread_getconcurrency(void);
3040Sstevel@tonic-gate extern int pthread_setconcurrency(int);
3050Sstevel@tonic-gate extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
3060Sstevel@tonic-gate extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *_RESTRICT_KYWD,
3070Sstevel@tonic-gate 	int *_RESTRICT_KYWD);
3080Sstevel@tonic-gate extern int pthread_rwlock_init(pthread_rwlock_t *_RESTRICT_KYWD,
3090Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD);
3100Sstevel@tonic-gate extern int pthread_rwlock_destroy(pthread_rwlock_t *);
3110Sstevel@tonic-gate extern int pthread_rwlock_rdlock(pthread_rwlock_t *);
3120Sstevel@tonic-gate extern int pthread_rwlock_timedrdlock(pthread_rwlock_t *_RESTRICT_KYWD,
3130Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3140Sstevel@tonic-gate extern int pthread_rwlock_reltimedrdlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3150Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3160Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
3170Sstevel@tonic-gate extern int pthread_rwlock_wrlock(pthread_rwlock_t *);
3180Sstevel@tonic-gate extern int pthread_rwlock_timedwrlock(pthread_rwlock_t *_RESTRICT_KYWD,
3190Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3200Sstevel@tonic-gate extern int pthread_rwlock_reltimedwrlock_np(pthread_rwlock_t *_RESTRICT_KYWD,
3210Sstevel@tonic-gate 	const struct timespec *_RESTRICT_KYWD);
3220Sstevel@tonic-gate extern int pthread_rwlock_trywrlock(pthread_rwlock_t *);
3230Sstevel@tonic-gate extern int pthread_rwlock_unlock(pthread_rwlock_t *);
3240Sstevel@tonic-gate extern int pthread_rwlockattr_init(pthread_rwlockattr_t *);
3250Sstevel@tonic-gate extern int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
3260Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared(
3270Sstevel@tonic-gate 	const pthread_rwlockattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3280Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
3290Sstevel@tonic-gate extern int pthread_spin_init(pthread_spinlock_t *, int);
3300Sstevel@tonic-gate extern int pthread_spin_destroy(pthread_spinlock_t *);
3310Sstevel@tonic-gate extern int pthread_spin_lock(pthread_spinlock_t *);
3320Sstevel@tonic-gate extern int pthread_spin_trylock(pthread_spinlock_t *);
3330Sstevel@tonic-gate extern int pthread_spin_unlock(pthread_spinlock_t *);
3340Sstevel@tonic-gate extern int pthread_barrierattr_init(pthread_barrierattr_t *);
3350Sstevel@tonic-gate extern int pthread_barrierattr_destroy(pthread_barrierattr_t *);
3360Sstevel@tonic-gate extern int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
3370Sstevel@tonic-gate extern int pthread_barrierattr_getpshared(
3380Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
3390Sstevel@tonic-gate extern int pthread_barrier_init(pthread_barrier_t *_RESTRICT_KYWD,
3400Sstevel@tonic-gate 	const pthread_barrierattr_t *_RESTRICT_KYWD, uint_t);
3410Sstevel@tonic-gate extern int pthread_barrier_destroy(pthread_barrier_t *);
3420Sstevel@tonic-gate extern int pthread_barrier_wait(pthread_barrier_t *);
3430Sstevel@tonic-gate 
344*8036SRoger.Faulkner@Sun.COM /* Historical names -- present only for binary compatibility */
345*8036SRoger.Faulkner@Sun.COM extern int pthread_mutex_consistent_np(pthread_mutex_t *);
346*8036SRoger.Faulkner@Sun.COM extern int pthread_mutexattr_setrobust_np(pthread_mutexattr_t *, int);
347*8036SRoger.Faulkner@Sun.COM extern int pthread_mutexattr_getrobust_np(
348*8036SRoger.Faulkner@Sun.COM 	const pthread_mutexattr_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
349*8036SRoger.Faulkner@Sun.COM 
3500Sstevel@tonic-gate #else	/* __STDC__ */
3510Sstevel@tonic-gate 
3520Sstevel@tonic-gate /*
3530Sstevel@tonic-gate  * function prototypes - thread related calls
3540Sstevel@tonic-gate  */
3550Sstevel@tonic-gate extern int pthread_atfork();
3560Sstevel@tonic-gate extern int pthread_attr_init();
3570Sstevel@tonic-gate extern int pthread_attr_destroy();
3580Sstevel@tonic-gate extern int pthread_attr_setstack();
3590Sstevel@tonic-gate extern int pthread_attr_getstack();
3600Sstevel@tonic-gate extern int pthread_attr_setstacksize();
3610Sstevel@tonic-gate extern int pthread_attr_getstacksize();
3620Sstevel@tonic-gate extern int pthread_attr_setstackaddr();
3630Sstevel@tonic-gate extern int pthread_attr_getstackaddr();
3640Sstevel@tonic-gate extern int pthread_attr_setdetachstate();
3650Sstevel@tonic-gate extern int pthread_attr_getdetachstate();
3660Sstevel@tonic-gate extern int pthread_attr_setscope();
3670Sstevel@tonic-gate extern int pthread_attr_getscope();
3680Sstevel@tonic-gate extern int pthread_attr_setinheritsched();
3690Sstevel@tonic-gate extern int pthread_attr_getinheritsched();
3700Sstevel@tonic-gate extern int pthread_attr_setschedpolicy();
3710Sstevel@tonic-gate extern int pthread_attr_getschedpolicy();
3720Sstevel@tonic-gate extern int pthread_attr_setschedparam();
3730Sstevel@tonic-gate extern int pthread_attr_getschedparam();
3740Sstevel@tonic-gate extern int pthread_create();
3750Sstevel@tonic-gate extern int pthread_once();
3760Sstevel@tonic-gate extern int pthread_join();
3770Sstevel@tonic-gate extern int pthread_detach();
3780Sstevel@tonic-gate extern void pthread_exit();
3790Sstevel@tonic-gate extern int pthread_cancel();
3800Sstevel@tonic-gate extern int pthread_setschedparam();
3810Sstevel@tonic-gate extern int pthread_getschedparam();
3820Sstevel@tonic-gate extern int pthread_setschedprio();
3830Sstevel@tonic-gate extern int pthread_setcancelstate();
3840Sstevel@tonic-gate extern int pthread_setcanceltype();
3850Sstevel@tonic-gate extern void pthread_testcancel();
3860Sstevel@tonic-gate extern int pthread_equal();
3870Sstevel@tonic-gate extern int pthread_key_create();
3883864Sraf extern int pthread_key_create_once_np();
3890Sstevel@tonic-gate extern int pthread_key_delete();
3900Sstevel@tonic-gate extern int pthread_setspecific();
3910Sstevel@tonic-gate extern void *pthread_getspecific();
3920Sstevel@tonic-gate extern pthread_t pthread_self();
3930Sstevel@tonic-gate /*
3940Sstevel@tonic-gate  * function prototypes - synchronization related calls
3950Sstevel@tonic-gate  */
3960Sstevel@tonic-gate extern int pthread_mutexattr_init();
3970Sstevel@tonic-gate extern int pthread_mutexattr_destroy();
3980Sstevel@tonic-gate extern int pthread_mutexattr_setpshared();
3990Sstevel@tonic-gate extern int pthread_mutexattr_getpshared();
4000Sstevel@tonic-gate extern int pthread_mutexattr_setprotocol();
4010Sstevel@tonic-gate extern int pthread_mutexattr_getprotocol();
4020Sstevel@tonic-gate extern int pthread_mutexattr_setprioceiling();
4030Sstevel@tonic-gate extern int pthread_mutexattr_getprioceiling();
404*8036SRoger.Faulkner@Sun.COM extern int pthread_mutexattr_setrobust();
405*8036SRoger.Faulkner@Sun.COM extern int pthread_mutexattr_getrobust();
4060Sstevel@tonic-gate extern int pthread_mutex_init();
407*8036SRoger.Faulkner@Sun.COM extern int pthread_mutex_consistent();
4080Sstevel@tonic-gate extern int pthread_mutex_destroy();
4090Sstevel@tonic-gate extern int pthread_mutex_lock();
4100Sstevel@tonic-gate extern int pthread_mutex_timedlock();
4110Sstevel@tonic-gate extern int pthread_mutex_reltimedlock_np();
4120Sstevel@tonic-gate extern int pthread_mutex_unlock();
4130Sstevel@tonic-gate extern int pthread_mutex_trylock();
4140Sstevel@tonic-gate extern int pthread_mutex_setprioceiling();
4150Sstevel@tonic-gate extern int pthread_mutex_getprioceiling();
4160Sstevel@tonic-gate extern int pthread_condattr_init();
4170Sstevel@tonic-gate extern int pthread_condattr_destroy();
4180Sstevel@tonic-gate extern int pthread_condattr_setclock();
4190Sstevel@tonic-gate extern int pthread_condattr_getclock();
4200Sstevel@tonic-gate extern int pthread_condattr_setpshared();
4210Sstevel@tonic-gate extern int pthread_condattr_getpshared();
4220Sstevel@tonic-gate extern int pthread_cond_init();
4230Sstevel@tonic-gate extern int pthread_cond_destroy();
4240Sstevel@tonic-gate extern int pthread_cond_broadcast();
4250Sstevel@tonic-gate extern int pthread_cond_signal();
4260Sstevel@tonic-gate extern int pthread_cond_wait();
4270Sstevel@tonic-gate extern int pthread_cond_timedwait();
4280Sstevel@tonic-gate extern int pthread_cond_reltimedwait_np();
4290Sstevel@tonic-gate extern int pthread_attr_getguardsize();
4300Sstevel@tonic-gate extern int pthread_attr_setguardsize();
4310Sstevel@tonic-gate extern int pthread_getconcurrency();
4320Sstevel@tonic-gate extern int pthread_setconcurrency();
4330Sstevel@tonic-gate extern int pthread_mutexattr_settype();
4340Sstevel@tonic-gate extern int pthread_mutexattr_gettype();
4350Sstevel@tonic-gate extern int pthread_rwlock_init();
4360Sstevel@tonic-gate extern int pthread_rwlock_destroy();
4370Sstevel@tonic-gate extern int pthread_rwlock_rdlock();
4380Sstevel@tonic-gate extern int pthread_rwlock_tryrdlock();
4390Sstevel@tonic-gate extern int pthread_rwlock_wrlock();
4400Sstevel@tonic-gate extern int pthread_rwlock_trywrlock();
4410Sstevel@tonic-gate extern int pthread_rwlock_unlock();
4420Sstevel@tonic-gate extern int pthread_rwlockattr_init();
4430Sstevel@tonic-gate extern int pthread_rwlockattr_destroy();
4440Sstevel@tonic-gate extern int pthread_rwlockattr_getpshared();
4450Sstevel@tonic-gate extern int pthread_rwlockattr_setpshared();
4460Sstevel@tonic-gate extern int pthread_spin_init();
4470Sstevel@tonic-gate extern int pthread_spin_destroy();
4480Sstevel@tonic-gate extern int pthread_spin_lock();
4490Sstevel@tonic-gate extern int pthread_spin_trylock();
4500Sstevel@tonic-gate extern int pthread_spin_unlock();
4510Sstevel@tonic-gate extern int pthread_barrierattr_init();
4520Sstevel@tonic-gate extern int pthread_barrierattr_destroy();
4530Sstevel@tonic-gate extern int pthread_barrierattr_setpshared();
4540Sstevel@tonic-gate extern int pthread_barrierattr_getpshared();
4550Sstevel@tonic-gate extern int pthread_barrier_init();
4560Sstevel@tonic-gate extern int pthread_barrier_destroy();
4570Sstevel@tonic-gate extern int pthread_barrier_wait();
4580Sstevel@tonic-gate 
459*8036SRoger.Faulkner@Sun.COM /* Historical names -- present only for binary compatibility */
460*8036SRoger.Faulkner@Sun.COM extern int pthread_mutex_consistent_np();
461*8036SRoger.Faulkner@Sun.COM extern int pthread_mutexattr_setrobust_np();
462*8036SRoger.Faulkner@Sun.COM extern int pthread_mutexattr_getrobust_np();
463*8036SRoger.Faulkner@Sun.COM 
4640Sstevel@tonic-gate #endif	/* __STDC__ */
4650Sstevel@tonic-gate 
4660Sstevel@tonic-gate #endif	/* _ASM */
4670Sstevel@tonic-gate 
4680Sstevel@tonic-gate #ifdef	__cplusplus
4690Sstevel@tonic-gate }
4700Sstevel@tonic-gate #endif
4710Sstevel@tonic-gate 
4720Sstevel@tonic-gate #endif	/* _PTHREAD_H */
473