From e6f40585685101e9679e9e535e790805a8d38c47 Mon Sep 17 00:00:00 2001 From: bje Date: Fri, 17 Jul 1998 14:07:23 +0000 Subject: 1998-07-18 Ben Elliston * pthread.h (pthread_cond_init): Add function protoype. (pthread_cond_broadcast): Likewise. (pthread_cond_signal): Likewise. (pthread_cond_timedwait): Likewise. (pthread_cond_wait): Likewise. (pthread_cond_destroy): Likewise. (pthread_cond_t): Define this type. --- pthread.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'pthread.h') diff --git a/pthread.h b/pthread.h index f5f980f..3f7e3c6 100644 --- a/pthread.h +++ b/pthread.h @@ -25,6 +25,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef HANDLE pthread_t; typedef CRITICAL_SECTION pthread_mutex_t; +typedef struct { + enum { SIGNAL, BROADCAST, NUM_EVENTS }; + + /* Signal and broadcast event HANDLEs. */ + HANDLE events[NUM_EVENTS]; + + /* Count of the number of waiters. */ + u_int waiters_count; + + /* Serialize access to waiters_count_. */ + CRITICAL_SECTION waiters_count_lock; +} pthread_cond_t; + typedef struct { void * ptr; } pthread_condattr_t; typedef struct { void * ptr; } pthread_mutexattr_t; @@ -87,6 +100,24 @@ int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared); +/* Primitives for condition variables. */ + +int pthread_cond_init(pthread_cond_t *cv, + const pthread_condattr_t *attr); + +int pthread_cond_broadcast(pthread_cond_t *cv); + +int pthread_cond_signal(pthread_cond_t *cv); + +int pthread_cond_timedwait(pthread_cond_t *cv, + pthread_mutex_t *mutex, + const struct timespec *abstime); + +int pthread_cond_wait(pthread_cond_t *cv, + pthread_mutex_t *mutex); + +int pthread_cond_destroy(pthread_cond_t *cv); + /* Primitives for mutexes. */ int pthread_mutex_init(pthread_mutex_t *mutex, -- cgit v1.2.3