Back to index

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

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

static void * tf (void *arg)
static int do_test (void)

Variables

static pthread_barrier_t b

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 78 of file tst-exit1.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 45 of file tst-exit1.c.

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

  pthread_t th;
  if (pthread_create (&th, NULL, tf, NULL) != 0)
    {
      puts ("create failed");
      exit (1);
    }

  int r = pthread_barrier_wait (&b);
  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
    {
      puts ("barrier_wait failed");
      exit (1);
    }

  /* Do nothing.  */
  if (pthread_join (th, NULL) == 0)
    {
      puts ("join succeeded!?");
      exit (1);
    }

  puts ("join returned!?");
  exit (1);
}

Here is the call graph for this function:

static void* tf ( void *  arg) [static]

Definition at line 31 of file tst-exit1.c.

{
  int r = pthread_barrier_wait (&b);
  if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
    {
      puts ("barrier_wait failed");
      exit (1);
    }

  exit (0);
}

Here is the call graph for this function:


Variable Documentation

pthread_barrier_t b [static]

Definition at line 27 of file tst-exit1.c.