summaryrefslogtreecommitdiff
path: root/pthread.h
diff options
context:
space:
mode:
authorbje <bje>1998-07-17 14:07:23 +0000
committerbje <bje>1998-07-17 14:07:23 +0000
commite6f40585685101e9679e9e535e790805a8d38c47 (patch)
treee7d253cd349f31d4086646ca5547797e5438b60a /pthread.h
parentd768d3b9e6ef5ee6984ede15703ce3aa6641c265 (diff)
1998-07-18 Ben Elliston <bje@cygnus.com>
* 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.
Diffstat (limited to 'pthread.h')
-rw-r--r--pthread.h31
1 files changed, 31 insertions, 0 deletions
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,