diff options
Diffstat (limited to 'pthread_barrier_init.c')
-rw-r--r-- | pthread_barrier_init.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/pthread_barrier_init.c b/pthread_barrier_init.c index dc1b50c..618bfae 100644 --- a/pthread_barrier_init.c +++ b/pthread_barrier_init.c @@ -55,25 +55,13 @@ pthread_barrier_init (pthread_barrier_t * barrier, ? (*attr)->pshared : PTHREAD_PROCESS_PRIVATE); b->nCurrentBarrierHeight = b->nInitialBarrierHeight = count; - b->iStep = 0; + b->lock = 0; - /* - * Two semaphores are used in the same way as two stepping - * stones might be used in crossing a stream. Once all - * threads are safely on one stone, the other stone can - * be moved ahead, and the threads can start moving to it. - * 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)) + if (0 == sem_init (&(b->semBarrierBreeched), b->pshared, 0)) { *barrier = b; return 0; } - (void) sem_destroy (&(b->semBarrierBreeched[0])); - } (void) free (b); } |