Back to index

glibc  2.9
pthread_barrier_destroy.c File Reference
#include <errno.h>
#include "pthreadP.h"
#include <lowlevellock.h>

Go to the source code of this file.


int pthread_barrier_destroy (pthread_barrier_t *barrier)

Function Documentation

int pthread_barrier_destroy ( pthread_barrier_t *  barrier)

Definition at line 25 of file pthread_barrier_destroy.c.

  union sparc_pthread_barrier *ibarrier;
  int result = EBUSY;

  ibarrier = (union sparc_pthread_barrier *) barrier;

  int private = ibarrier->s.pshared ? LLL_SHARED : LLL_PRIVATE;

  lll_lock (ibarrier->b.lock, private);

  if (__builtin_expect (ibarrier->b.left == ibarrier->b.init_count, 1))
    /* The barrier is not used anymore.  */
    result = 0;
    /* Still used, return with an error.  */
    lll_unlock (ibarrier->b.lock, private);

  return result;