diff options
author | rpj <rpj> | 2001-06-03 16:41:27 +0000 |
---|---|---|
committer | rpj <rpj> | 2001-06-03 16:41:27 +0000 |
commit | 5b826fe110d9cde198d2aae27e144ac635ad921f (patch) | |
tree | 7bc68cc31f521209cd0d9c78c55abaa56e8ff253 /implement.h | |
parent | 860ecc4c24475dc3d3efe0adc981071f2aaf1299 (diff) |
pthreads:
2001-06-03 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
Contributed by - Alexander Terekhov <TEREKHOV@de.ibm.com>
- Louis Thomas <lthomas@arbitrade.com>
* condvar.c (pthread_cond_init): Completely revamped.
(pthread_cond_destroy): Likewise.
(ptw32_cond_wait_cleanup): Likewise.
(ptw32_cond_timedwait): Likewise.
(ptw32_cond_unblock): New general signaling routine.
(pthread_cond_signal): Now calls ptw32_cond_unblock.
(pthread_cond_broadcast): Likewise.
* implement.h (pthread_cond_t_): Revamped.
* README.CV: New; explanation of the above changes.
pthreads/tests:
2001-06-3 Ross Johnson <rpj@special.ise.canberra.edu.au>
* condvar2_1.c: New test.
* condvar3_1.c: New test.
* condvar3_2.c: New test.
Diffstat (limited to 'implement.h')
-rw-r--r-- | implement.h | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/implement.h b/implement.h index fa02444..1b57b60 100644 --- a/implement.h +++ b/implement.h @@ -27,10 +27,14 @@ #ifndef _IMPLEMENT_H #define _IMPLEMENT_H -#if defined(__MINGW32__) +#if !defined(malloc) #include <malloc.h> #endif +#if !defined(INT_MAX) +#include <limits.h> +#endif + /* changed include from <semaphore.h> to use local file during development */ #include "semaphore.h" @@ -153,18 +157,18 @@ struct ThreadParms { struct pthread_cond_t_ { - long waiters; /* # waiting threads */ - pthread_mutex_t waitersLock; /* Mutex that guards access to - waiter count */ - sem_t sema; /* Queue up threads waiting for the - condition to become signaled */ - HANDLE waitersDone; /* An auto reset event used by the - broadcast/signal thread to wait - for the waiting thread(s) to wake - up and get a chance at the - semaphore */ - int wasBroadcast; /* keeps track if we are signaling - or broadcasting */ + long nWaitersBlocked; /* Number of threads blocked */ + long nWaitersGone; /* Number of threads timed out */ + long nWaitersUnblocked; /* Number of threads unblocked */ + long nWaitersToUnblock; /* Number of threads to unblock */ + sem_t semBlockQueue; /* Queue up threads waiting for the */ + /* condition to become signalled */ + sem_t semBlockLock; /* Semaphore that guards access to */ + /* | waiters blocked count/block queue */ + /* +-> Mandatory Sync.LEVEL-1 */ + pthread_mutex_t mtxUnblockLock; /* Mutex that guards access to */ + /* | waiters (to)unblock(ed) counts */ + /* +-> Optional* Sync.LEVEL-2 */ }; |