From 1d99828acf48bc6d5a81aadc6123e5172dfc355d Mon Sep 17 00:00:00 2001 From: rpj Date: Mon, 9 Jul 2001 18:22:07 +0000 Subject: * barrier.c: Revamped to fix the race condition. Two alternating semaphores are used instead of the PulseEvent. Also improved overall throughput by returning PTHREAD_BARRIER_SERIAL_THREAD to the first waking thread. * implement.h (pthread_barrier_t_): Revamped. --- implement.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'implement.h') diff --git a/implement.h b/implement.h index 5b30d1a..bc72b3f 100644 --- a/implement.h +++ b/implement.h @@ -187,10 +187,12 @@ struct pthread_spinlock_t_ { }; struct pthread_barrier_t_ { - LONG nCurrentBarrierHeight; - LONG nInitialBarrierHeight; + unsigned int nCurrentBarrierHeight; + unsigned int nInitialBarrierHeight; + unsigned int nSerial; + int iStep; pthread_mutex_t mtxExclusiveAccess; - HANDLE eventBarrierBreeched; + sem_t semBarrierBreeched[2]; }; struct pthread_barrierattr_t_ { -- cgit v1.2.3