From d330ac695b57dbcf32ac455c89e72a3a8f8bb956 Mon Sep 17 00:00:00 2001 From: rpj Date: Wed, 11 Jul 2001 01:46:44 +0000 Subject: Fixed cast; tests passed. --- barrier.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'barrier.c') diff --git a/barrier.c b/barrier.c index 3077e9b..fa52cbf 100644 --- a/barrier.c +++ b/barrier.c @@ -125,7 +125,7 @@ pthread_barrier_wait(pthread_barrier_t *barrier) b = *barrier; step = b->iStep; - if (0 == InterlockedDecrement((_LPLONG) &(b->nCurrentBarrierHeight))) + if (0 == InterlockedDecrement((long *) &(b->nCurrentBarrierHeight))) { /* Must be done before posting the semaphore. */ b->nCurrentBarrierHeight = b->nInitialBarrierHeight; @@ -136,14 +136,13 @@ pthread_barrier_wait(pthread_barrier_t *barrier) * entered barrier_wait and checked nCurrentBarrierHeight before this * barrier's sema can be posted. Any threads that have not quite * entered sem_wait below when the multiple_post has completed - * will nevertheless continue through the sema (barrier) + * will nevertheless continue through the semaphore (barrier) * and will not be left stranded. */ - if (b->nInitialBarrierHeight > 1) - { - result = sem_post_multiple(&(b->semBarrierBreeched[step]), - b->nInitialBarrierHeight - 1); - } + result = (b->nInitialBarrierHeight > 1 + ? sem_post_multiple(&(b->semBarrierBreeched[step]), + b->nInitialBarrierHeight - 1) + : 0); } else { -- cgit v1.2.3