1199767f8SToomas Soome /* 2199767f8SToomas Soome * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu 3199767f8SToomas Soome * Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au> 4199767f8SToomas Soome * All rights reserved. 5199767f8SToomas Soome * 6199767f8SToomas Soome * Redistribution and use in source and binary forms, with or without 7199767f8SToomas Soome * modification, are permitted provided that the following conditions 8199767f8SToomas Soome * are met: 9199767f8SToomas Soome * 1. Redistributions of source code must retain the above copyright 10199767f8SToomas Soome * notice, this list of conditions and the following disclaimer. 11199767f8SToomas Soome * 2. Redistributions in binary form must reproduce the above copyright 12199767f8SToomas Soome * notice, this list of conditions and the following disclaimer in the 13199767f8SToomas Soome * documentation and/or other materials provided with the distribution. 14199767f8SToomas Soome * 3. All advertising materials mentioning features or use of this software 15199767f8SToomas Soome * must display the following acknowledgement: 16199767f8SToomas Soome * This product includes software developed by Chris Provenzano. 17*55fea89dSDan Cross * 4. The name of Chris Provenzano may not be used to endorse or promote 18199767f8SToomas Soome * products derived from this software without specific prior written 19199767f8SToomas Soome * permission. 20199767f8SToomas Soome * 21199767f8SToomas Soome * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND 22199767f8SToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23199767f8SToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24*55fea89dSDan Cross * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY 25199767f8SToomas Soome * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26*55fea89dSDan Cross * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27199767f8SToomas Soome * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28*55fea89dSDan Cross * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29199767f8SToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30*55fea89dSDan Cross * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31199767f8SToomas Soome * SUCH DAMAGE. 32199767f8SToomas Soome * 33199767f8SToomas Soome * $FreeBSD$ 34199767f8SToomas Soome */ 35199767f8SToomas Soome 36199767f8SToomas Soome #ifndef _SYS__PTHREADTYPES_H_ 37199767f8SToomas Soome #define _SYS__PTHREADTYPES_H_ 38199767f8SToomas Soome 39199767f8SToomas Soome /* 40199767f8SToomas Soome * Forward structure definitions. 41199767f8SToomas Soome * 42199767f8SToomas Soome * These are mostly opaque to the user. 43199767f8SToomas Soome */ 44199767f8SToomas Soome struct pthread; 45199767f8SToomas Soome struct pthread_attr; 46199767f8SToomas Soome struct pthread_cond; 47199767f8SToomas Soome struct pthread_cond_attr; 48199767f8SToomas Soome struct pthread_mutex; 49199767f8SToomas Soome struct pthread_mutex_attr; 50199767f8SToomas Soome struct pthread_once; 51199767f8SToomas Soome struct pthread_rwlock; 52199767f8SToomas Soome struct pthread_rwlockattr; 53199767f8SToomas Soome struct pthread_barrier; 54199767f8SToomas Soome struct pthread_barrier_attr; 55199767f8SToomas Soome struct pthread_spinlock; 56199767f8SToomas Soome 57199767f8SToomas Soome /* 58199767f8SToomas Soome * Primitive system data type definitions required by P1003.1c. 59199767f8SToomas Soome * 60199767f8SToomas Soome * Note that P1003.1c specifies that there are no defined comparison 61199767f8SToomas Soome * or assignment operators for the types pthread_attr_t, pthread_cond_t, 62199767f8SToomas Soome * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. 63199767f8SToomas Soome */ 64199767f8SToomas Soome #ifndef _PTHREAD_T_DECLARED 65199767f8SToomas Soome typedef struct pthread *pthread_t; 66199767f8SToomas Soome #define _PTHREAD_T_DECLARED 67199767f8SToomas Soome #endif 68199767f8SToomas Soome typedef struct pthread_attr *pthread_attr_t; 69199767f8SToomas Soome typedef struct pthread_mutex *pthread_mutex_t; 70199767f8SToomas Soome typedef struct pthread_mutex_attr *pthread_mutexattr_t; 71199767f8SToomas Soome typedef struct pthread_cond *pthread_cond_t; 72199767f8SToomas Soome typedef struct pthread_cond_attr *pthread_condattr_t; 73199767f8SToomas Soome typedef int pthread_key_t; 74199767f8SToomas Soome typedef struct pthread_once pthread_once_t; 75199767f8SToomas Soome typedef struct pthread_rwlock *pthread_rwlock_t; 76199767f8SToomas Soome typedef struct pthread_rwlockattr *pthread_rwlockattr_t; 77199767f8SToomas Soome typedef struct pthread_barrier *pthread_barrier_t; 78199767f8SToomas Soome typedef struct pthread_barrierattr *pthread_barrierattr_t; 79199767f8SToomas Soome typedef struct pthread_spinlock *pthread_spinlock_t; 80199767f8SToomas Soome 81199767f8SToomas Soome /* 82199767f8SToomas Soome * Additional type definitions: 83199767f8SToomas Soome * 84199767f8SToomas Soome * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for 85199767f8SToomas Soome * use in header symbols. 86199767f8SToomas Soome */ 87199767f8SToomas Soome typedef void *pthread_addr_t; 88199767f8SToomas Soome typedef void *(*pthread_startroutine_t)(void *); 89199767f8SToomas Soome 90199767f8SToomas Soome /* 91199767f8SToomas Soome * Once definitions. 92199767f8SToomas Soome */ 93199767f8SToomas Soome struct pthread_once { 94199767f8SToomas Soome int state; 95199767f8SToomas Soome pthread_mutex_t mutex; 96199767f8SToomas Soome }; 97199767f8SToomas Soome 98199767f8SToomas Soome #endif /* ! _SYS__PTHREADTYPES_H_ */ 99