From 771465fed0cf50ee2dd790723245fc091699c324 Mon Sep 17 00:00:00 2001 From: rpj Date: Mon, 17 May 2004 01:38:02 +0000 Subject: re-indentation, bug fixes, hooks for pre-emptive async cancelation --- pthread_barrier_init.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'pthread_barrier_init.c') diff --git a/pthread_barrier_init.c b/pthread_barrier_init.c index d8d7877..3603ac3 100644 --- a/pthread_barrier_init.c +++ b/pthread_barrier_init.c @@ -39,9 +39,8 @@ int -pthread_barrier_init(pthread_barrier_t * barrier, - const pthread_barrierattr_t * attr, - unsigned int count) +pthread_barrier_init (pthread_barrier_t * barrier, + const pthread_barrierattr_t * attr, unsigned int count) { pthread_barrier_t b; @@ -50,11 +49,10 @@ pthread_barrier_init(pthread_barrier_t * barrier, return EINVAL; } - if (NULL != (b = (pthread_barrier_t) calloc(1, sizeof(*b)))) + if (NULL != (b = (pthread_barrier_t) calloc (1, sizeof (*b)))) { b->pshared = (attr != NULL && *attr != NULL - ? (*attr)->pshared - : PTHREAD_PROCESS_PRIVATE); + ? (*attr)->pshared : PTHREAD_PROCESS_PRIVATE); b->nCurrentBarrierHeight = b->nInitialBarrierHeight = count; b->iStep = 0; @@ -67,18 +65,17 @@ pthread_barrier_init(pthread_barrier_t * barrier, * If some threads decide to eat their lunch before moving * then the other threads have to wait. */ - if (0 == sem_init(&(b->semBarrierBreeched[0]), b->pshared, 0)) - { - if (0 == sem_init(&(b->semBarrierBreeched[1]), b->pshared, 0)) - { - *barrier = b; - return 0; - } - (void) sem_destroy(&(b->semBarrierBreeched[0])); - } - (void) free(b); + if (0 == sem_init (&(b->semBarrierBreeched[0]), b->pshared, 0)) + { + if (0 == sem_init (&(b->semBarrierBreeched[1]), b->pshared, 0)) + { + *barrier = b; + return 0; + } + (void) sem_destroy (&(b->semBarrierBreeched[0])); + } + (void) free (b); } return ENOMEM; } - -- cgit v1.2.3