summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>2001-07-11 01:46:44 +0000
committerrpj <rpj>2001-07-11 01:46:44 +0000
commitd330ac695b57dbcf32ac455c89e72a3a8f8bb956 (patch)
treed72b14174a9cf4d96ea92ef8a1eafb930fbf4c38
parent65801c9226cebcec8d8ab164175bad236230e02d (diff)
Fixed cast; tests passed.
-rw-r--r--barrier.c13
1 files changed, 6 insertions, 7 deletions
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
{