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 26 of file pthread_barrier_destroy.c.

  struct pthread_barrier *ibarrier;
  int result = EBUSY;

  ibarrier = (struct pthread_barrier *) barrier;

  lll_lock (ibarrier->lock, ibarrier->private ^ FUTEX_PRIVATE_FLAG);

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

  return result;