summaryrefslogtreecommitdiff
path: root/pthread.h
diff options
context:
space:
mode:
authorrpj <rpj>1999-03-11 15:06:20 +0000
committerrpj <rpj>1999-03-11 15:06:20 +0000
commitb14e60afab45a7bc5eff231f408505a1bec6b436 (patch)
tree4f9980eea7b03957476af05736a2c8364027d9c3 /pthread.h
parent52f7c3f5ef6d9b70ec385fb390bf27962e68ee3d (diff)
Thu Mar 11 09:01:48 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* pthread.h (pthread_mutex_t): revert to (pthread_mutex_t *); define a value to serve as PTHREAD_MUTEX_INITIALIZER. (pthread_mutex_t_): remove staticinit and valid elements. (pthread_cond_t): revert to (pthread_cond_t_ *); define a value to serve as PTHREAD_COND_INITIALIZER. (pthread_cond_t_): remove staticinit and valid elements. * mutex.c (pthread_mutex_t args): adjust indirection of references. (all functions): check for PTHREAD_MUTEX_INITIALIZER value; check for NULL (invalid). * condvar.c (pthread_cond_t args): adjust indirection of references. (all functions): check for PTHREAD_COND_INITIALIZER value; check for NULL (invalid). Wed Mar 10 17:18:12 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * misc.c (CancelableWait): Undo changes from Mar 8 and 7. tests/ChangeLog Fri Mar 12 08:34:15 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * eyal1.c (main): Fix trylock loop; was not waiting for thread to lock the "started" mutex.
Diffstat (limited to 'pthread.h')
-rw-r--r--pthread.h27
1 files changed, 10 insertions, 17 deletions
diff --git a/pthread.h b/pthread.h
index da40f48..8f66e48 100644
--- a/pthread.h
+++ b/pthread.h
@@ -419,9 +419,9 @@ extern "C"
typedef struct pthread_attr_t_ *pthread_attr_t;
typedef struct pthread_once_t_ pthread_once_t;
typedef struct pthread_key_t_ *pthread_key_t;
- typedef struct pthread_mutex_t_ pthread_mutex_t;
+ typedef struct pthread_mutex_t_ *pthread_mutex_t;
typedef struct pthread_mutexattr_t_ *pthread_mutexattr_t;
- typedef struct pthread_cond_t_ pthread_cond_t;
+ typedef struct pthread_cond_t_ *pthread_cond_t;
typedef struct pthread_condattr_t_ *pthread_condattr_t;
@@ -567,16 +567,19 @@ struct pthread_attr_t_ {
/*
* ====================
* ====================
- * Mutex
+ * Mutexes and Condition Variables
* ====================
* ====================
*/
-#define PTHREAD_MUTEX_INITIALIZER { 1, 1 /* Remaining are all 0 */ }
+enum {
+ _PTHREAD_OBJECT_INVALID = 0, /* NULL */
+ _PTHREAD_OBJECT_AUTO_INIT
+};
+
+#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) _PTHREAD_OBJECT_AUTO_INIT)
struct pthread_mutex_t_ {
- int staticinit; /* Needs implicit init if 1. */
- int valid; /* Not destroyed if 1. */
HANDLE mutex;
CRITICAL_SECTION cs;
};
@@ -596,21 +599,11 @@ struct pthread_key_t_ {
};
-/*
- * ====================
- * ====================
- * Condition Variable
- * ====================
- * ====================
- */
-
-#define PTHREAD_COND_INITIALIZER { 1, 1 /* Remaining are all 0 */ }
+#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) _PTHREAD_OBJECT_AUTO_INIT)
typedef HANDLE _pthread_sem_t;
struct pthread_cond_t_ {
- int staticinit; /* Needs implicit init if 1. */
- int valid; /* Not destroyed if 1. */
long waiters; /* # waiting threads */
pthread_mutex_t waitersLock; /* Mutex that guards access to
waiter count */