Back to index

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

Go to the source code of this file.

Defines

#define EXPECTED_SIGNAL   SIGALRM
#define TEST_FUNCTION   do_test ()

Functions

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

Variables

static pthread_barrier_t b

Define Documentation

#define EXPECTED_SIGNAL   SIGALRM

Definition at line 79 of file tst-exit3.c.

#define TEST_FUNCTION   do_test ()

Definition at line 80 of file tst-exit3.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 48 of file tst-exit3.c.

{
  pthread_t th;

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

  int e = pthread_create (&th, NULL, tf, NULL);
  if (e != 0)
    {
      printf ("create failed: %s\n", strerror (e));
      exit (1);
    }

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

  /* Terminate only this thread.  */
  pthread_exit (NULL);

  /* NOTREACHED */
  return 1;
}

Here is the call graph for this function:

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

Definition at line 24 of file tst-exit3.c.

{
  pthread_t th;

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

  e = pthread_create (&th, NULL, tf2, NULL);
  if (e != 0)
    {
      printf ("create failed: %s\n", strerror (e));
      exit (1);
    }

  /* Terminate only this thread.  */
  return NULL;
}

Here is the call graph for this function:

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

Definition at line 13 of file tst-exit3.c.

{
  while (1)
    sleep (100);

  /* NOTREACHED */
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

pthread_barrier_t b [static]

Definition at line 9 of file tst-exit3.c.