1*199767f8SToomas Soome /* 2*199767f8SToomas Soome * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu 3*199767f8SToomas Soome * Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au> 4*199767f8SToomas Soome * All rights reserved. 5*199767f8SToomas Soome * 6*199767f8SToomas Soome * Redistribution and use in source and binary forms, with or without 7*199767f8SToomas Soome * modification, are permitted provided that the following conditions 8*199767f8SToomas Soome * are met: 9*199767f8SToomas Soome * 1. Redistributions of source code must retain the above copyright 10*199767f8SToomas Soome * notice, this list of conditions and the following disclaimer. 11*199767f8SToomas Soome * 2. Redistributions in binary form must reproduce the above copyright 12*199767f8SToomas Soome * notice, this list of conditions and the following disclaimer in the 13*199767f8SToomas Soome * documentation and/or other materials provided with the distribution. 14*199767f8SToomas Soome * 3. All advertising materials mentioning features or use of this software 15*199767f8SToomas Soome * must display the following acknowledgement: 16*199767f8SToomas Soome * This product includes software developed by Chris Provenzano. 17*199767f8SToomas Soome * 4. The name of Chris Provenzano may not be used to endorse or promote 18*199767f8SToomas Soome * products derived from this software without specific prior written 19*199767f8SToomas Soome * permission. 20*199767f8SToomas Soome * 21*199767f8SToomas Soome * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND 22*199767f8SToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23*199767f8SToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24*199767f8SToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY 25*199767f8SToomas Soome * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26*199767f8SToomas Soome * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27*199767f8SToomas Soome * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28*199767f8SToomas Soome * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29*199767f8SToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30*199767f8SToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31*199767f8SToomas Soome * SUCH DAMAGE. 32*199767f8SToomas Soome * 33*199767f8SToomas Soome * $FreeBSD$ 34*199767f8SToomas Soome */ 35*199767f8SToomas Soome 36*199767f8SToomas Soome #ifndef _SYS__PTHREADTYPES_H_ 37*199767f8SToomas Soome #define _SYS__PTHREADTYPES_H_ 38*199767f8SToomas Soome 39*199767f8SToomas Soome /* 40*199767f8SToomas Soome * Forward structure definitions. 41*199767f8SToomas Soome * 42*199767f8SToomas Soome * These are mostly opaque to the user. 43*199767f8SToomas Soome */ 44*199767f8SToomas Soome struct pthread; 45*199767f8SToomas Soome struct pthread_attr; 46*199767f8SToomas Soome struct pthread_cond; 47*199767f8SToomas Soome struct pthread_cond_attr; 48*199767f8SToomas Soome struct pthread_mutex; 49*199767f8SToomas Soome struct pthread_mutex_attr; 50*199767f8SToomas Soome struct pthread_once; 51*199767f8SToomas Soome struct pthread_rwlock; 52*199767f8SToomas Soome struct pthread_rwlockattr; 53*199767f8SToomas Soome struct pthread_barrier; 54*199767f8SToomas Soome struct pthread_barrier_attr; 55*199767f8SToomas Soome struct pthread_spinlock; 56*199767f8SToomas Soome 57*199767f8SToomas Soome /* 58*199767f8SToomas Soome * Primitive system data type definitions required by P1003.1c. 59*199767f8SToomas Soome * 60*199767f8SToomas Soome * Note that P1003.1c specifies that there are no defined comparison 61*199767f8SToomas Soome * or assignment operators for the types pthread_attr_t, pthread_cond_t, 62*199767f8SToomas Soome * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. 63*199767f8SToomas Soome */ 64*199767f8SToomas Soome #ifndef _PTHREAD_T_DECLARED 65*199767f8SToomas Soome typedef struct pthread *pthread_t; 66*199767f8SToomas Soome #define _PTHREAD_T_DECLARED 67*199767f8SToomas Soome #endif 68*199767f8SToomas Soome typedef struct pthread_attr *pthread_attr_t; 69*199767f8SToomas Soome typedef struct pthread_mutex *pthread_mutex_t; 70*199767f8SToomas Soome typedef struct pthread_mutex_attr *pthread_mutexattr_t; 71*199767f8SToomas Soome typedef struct pthread_cond *pthread_cond_t; 72*199767f8SToomas Soome typedef struct pthread_cond_attr *pthread_condattr_t; 73*199767f8SToomas Soome typedef int pthread_key_t; 74*199767f8SToomas Soome typedef struct pthread_once pthread_once_t; 75*199767f8SToomas Soome typedef struct pthread_rwlock *pthread_rwlock_t; 76*199767f8SToomas Soome typedef struct pthread_rwlockattr *pthread_rwlockattr_t; 77*199767f8SToomas Soome typedef struct pthread_barrier *pthread_barrier_t; 78*199767f8SToomas Soome typedef struct pthread_barrierattr *pthread_barrierattr_t; 79*199767f8SToomas Soome typedef struct pthread_spinlock *pthread_spinlock_t; 80*199767f8SToomas Soome 81*199767f8SToomas Soome /* 82*199767f8SToomas Soome * Additional type definitions: 83*199767f8SToomas Soome * 84*199767f8SToomas Soome * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for 85*199767f8SToomas Soome * use in header symbols. 86*199767f8SToomas Soome */ 87*199767f8SToomas Soome typedef void *pthread_addr_t; 88*199767f8SToomas Soome typedef void *(*pthread_startroutine_t)(void *); 89*199767f8SToomas Soome 90*199767f8SToomas Soome /* 91*199767f8SToomas Soome * Once definitions. 92*199767f8SToomas Soome */ 93*199767f8SToomas Soome struct pthread_once { 94*199767f8SToomas Soome int state; 95*199767f8SToomas Soome pthread_mutex_t mutex; 96*199767f8SToomas Soome }; 97*199767f8SToomas Soome 98*199767f8SToomas Soome #endif /* ! _SYS__PTHREADTYPES_H_ */ 99