1146824Srodrigc/*
2146824Srodrigc * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu
3146824Srodrigc * Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au>
4146824Srodrigc * All rights reserved.
5146824Srodrigc *
6146824Srodrigc * Redistribution and use in source and binary forms, with or without
7146824Srodrigc * modification, are permitted provided that the following conditions
8146824Srodrigc * are met:
9146824Srodrigc * 1. Redistributions of source code must retain the above copyright
10146824Srodrigc *    notice, this list of conditions and the following disclaimer.
11146824Srodrigc * 2. Redistributions in binary form must reproduce the above copyright
12146824Srodrigc *    notice, this list of conditions and the following disclaimer in the
13146824Srodrigc *    documentation and/or other materials provided with the distribution.
14146824Srodrigc * 3. All advertising materials mentioning features or use of this software
15146824Srodrigc *    must display the following acknowledgement:
16146824Srodrigc *  This product includes software developed by Chris Provenzano.
17146824Srodrigc * 4. The name of Chris Provenzano may not be used to endorse or promote
18146824Srodrigc *	  products derived from this software without specific prior written
19146824Srodrigc *	  permission.
20146824Srodrigc *
21146824Srodrigc * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
22146824Srodrigc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23146824Srodrigc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24146824Srodrigc * ARE DISCLAIMED.  IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
25146824Srodrigc * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26146824Srodrigc * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27146824Srodrigc * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28146824Srodrigc * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29146824Srodrigc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30146824Srodrigc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31146824Srodrigc * SUCH DAMAGE.
32146824Srodrigc *
33146824Srodrigc * $FreeBSD$
34146824Srodrigc */
35146824Srodrigc
36146824Srodrigc#ifndef _SYS__PTHREADTYPES_H_
37146824Srodrigc#define _SYS__PTHREADTYPES_H_
38146824Srodrigc
39146824Srodrigc/*
40146824Srodrigc * Forward structure definitions.
41146824Srodrigc *
42146824Srodrigc * These are mostly opaque to the user.
43146824Srodrigc */
44146824Srodrigcstruct pthread;
45146824Srodrigcstruct pthread_attr;
46146824Srodrigcstruct pthread_cond;
47146824Srodrigcstruct pthread_cond_attr;
48146824Srodrigcstruct pthread_mutex;
49146824Srodrigcstruct pthread_mutex_attr;
50146824Srodrigcstruct pthread_once;
51146824Srodrigcstruct pthread_rwlock;
52146824Srodrigcstruct pthread_rwlockattr;
53146824Srodrigcstruct pthread_barrier;
54146824Srodrigcstruct pthread_barrier_attr;
55146824Srodrigcstruct pthread_spinlock;
56146824Srodrigc
57146824Srodrigc/*
58146824Srodrigc * Primitive system data type definitions required by P1003.1c.
59146824Srodrigc *
60146824Srodrigc * Note that P1003.1c specifies that there are no defined comparison
61146824Srodrigc * or assignment operators for the types pthread_attr_t, pthread_cond_t,
62146824Srodrigc * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
63146824Srodrigc */
64189828Sdas#ifndef _PTHREAD_T_DECLARED
65146824Srodrigctypedef struct	pthread			*pthread_t;
66189828Sdas#define	_PTHREAD_T_DECLARED
67189828Sdas#endif
68146824Srodrigctypedef struct	pthread_attr		*pthread_attr_t;
69146824Srodrigctypedef struct	pthread_mutex		*pthread_mutex_t;
70146824Srodrigctypedef struct	pthread_mutex_attr	*pthread_mutexattr_t;
71146824Srodrigctypedef struct	pthread_cond		*pthread_cond_t;
72146824Srodrigctypedef struct	pthread_cond_attr	*pthread_condattr_t;
73146824Srodrigctypedef int     			pthread_key_t;
74146824Srodrigctypedef struct	pthread_once		pthread_once_t;
75146824Srodrigctypedef struct	pthread_rwlock		*pthread_rwlock_t;
76146824Srodrigctypedef struct	pthread_rwlockattr	*pthread_rwlockattr_t;
77146824Srodrigctypedef struct	pthread_barrier		*pthread_barrier_t;
78146824Srodrigctypedef struct	pthread_barrierattr	*pthread_barrierattr_t;
79146824Srodrigctypedef struct	pthread_spinlock	*pthread_spinlock_t;
80146824Srodrigc
81146824Srodrigc/*
82146824Srodrigc * Additional type definitions:
83146824Srodrigc *
84146824Srodrigc * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
85146824Srodrigc * use in header symbols.
86146824Srodrigc */
87146824Srodrigctypedef void	*pthread_addr_t;
88146824Srodrigctypedef void	*(*pthread_startroutine_t)(void *);
89146824Srodrigc
90146824Srodrigc/*
91146824Srodrigc * Once definitions.
92146824Srodrigc */
93146824Srodrigcstruct pthread_once {
94146824Srodrigc	int		state;
95146824Srodrigc	pthread_mutex_t	mutex;
96146824Srodrigc};
97146824Srodrigc
98146824Srodrigc#endif /* ! _SYS__PTHREADTYPES_H_ */
99