Back to index

glibc  2.9
Defines | Functions
tst-barrier1.c File Reference
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

static int do_test (void)

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 70 of file tst-barrier1.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 26 of file tst-barrier1.c.

{
  pthread_barrier_t b;
  int e;
  int cnt;

  e = pthread_barrier_init (&b, NULL, 0);
  if (e == 0)
    {
      puts ("barrier_init with count 0 succeeded");
      return 1;
    }
  if (e != EINVAL)
    {
      puts ("barrier_init with count 0 didn't return EINVAL");
      return 1;
    }

  if (pthread_barrier_init (&b, NULL, 1) != 0)
    {
      puts ("real barrier_init failed");
      return 1;
    }

  for (cnt = 0; cnt < 10; ++cnt)
    {
      e = pthread_barrier_wait (&b);

      if (e != PTHREAD_BARRIER_SERIAL_THREAD)
       {
         puts ("barrier_wait didn't return PTHREAD_BARRIER_SERIAL_THREAD");
         return 1;
       }
    }

  if (pthread_barrier_destroy (&b) != 0)
    {
      puts ("barrier_destroy failed");
      return 1;
    }

  return 0;
}

Here is the call graph for this function: