199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au>
199767f8919635c4928607450d9e0abb932109ceToomas Soome * All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Redistribution and use in source and binary forms, with or without
199767f8919635c4928607450d9e0abb932109ceToomas Soome * modification, are permitted provided that the following conditions
199767f8919635c4928607450d9e0abb932109ceToomas Soome * are met:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 1. Redistributions of source code must retain the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
199767f8919635c4928607450d9e0abb932109ceToomas Soome * notice, this list of conditions and the following disclaimer in the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * documentation and/or other materials provided with the distribution.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 3. All advertising materials mentioning features or use of this software
199767f8919635c4928607450d9e0abb932109ceToomas Soome * must display the following acknowledgement:
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This product includes software developed by Chris Provenzano.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * 4. The name of Chris Provenzano may not be used to endorse or promote
199767f8919635c4928607450d9e0abb932109ceToomas Soome * products derived from this software without specific prior written
199767f8919635c4928607450d9e0abb932109ceToomas Soome * permission.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199767f8919635c4928607450d9e0abb932109ceToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
199767f8919635c4928607450d9e0abb932109ceToomas Soome * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
199767f8919635c4928607450d9e0abb932109ceToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
199767f8919635c4928607450d9e0abb932109ceToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
199767f8919635c4928607450d9e0abb932109ceToomas Soome * SUCH DAMAGE.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * $FreeBSD$
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _SYS__PTHREADTYPES_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _SYS__PTHREADTYPES_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Forward structure definitions.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * These are mostly opaque to the user.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_attr;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_cond;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_cond_attr;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_mutex;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_mutex_attr;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_once;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_rwlock;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_rwlockattr;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_barrier;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_barrier_attr;
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_spinlock;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Primitive system data type definitions required by P1003.1c.
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Note that P1003.1c specifies that there are no defined comparison
199767f8919635c4928607450d9e0abb932109ceToomas Soome * or assignment operators for the types pthread_attr_t, pthread_cond_t,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _PTHREAD_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread *pthread_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _PTHREAD_T_DECLARED
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_attr *pthread_attr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_mutex *pthread_mutex_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_mutex_attr *pthread_mutexattr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_cond *pthread_cond_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_cond_attr *pthread_condattr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef int pthread_key_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_once pthread_once_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_rwlock *pthread_rwlock_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_rwlockattr *pthread_rwlockattr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_barrier *pthread_barrier_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_barrierattr *pthread_barrierattr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef struct pthread_spinlock *pthread_spinlock_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Additional type definitions:
199767f8919635c4928607450d9e0abb932109ceToomas Soome *
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
199767f8919635c4928607450d9e0abb932109ceToomas Soome * use in header symbols.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef void *pthread_addr_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef void *(*pthread_startroutine_t)(void *);
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Once definitions.
199767f8919635c4928607450d9e0abb932109ceToomas Soome */
199767f8919635c4928607450d9e0abb932109ceToomas Soomestruct pthread_once {
199767f8919635c4928607450d9e0abb932109ceToomas Soome int state;
199767f8919635c4928607450d9e0abb932109ceToomas Soome pthread_mutex_t mutex;
199767f8919635c4928607450d9e0abb932109ceToomas Soome};
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* ! _SYS__PTHREADTYPES_H_ */