Back to index

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

Go to the source code of this file.

Defines

#define EXPECTED_SIGNAL   SIGALRM
#define TIMEOUT   3
#define TEST_FUNCTION   do_test ()

Functions

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

Define Documentation

#define EXPECTED_SIGNAL   SIGALRM

Definition at line 102 of file tst-eintr1.c.

#define TEST_FUNCTION   do_test ()

Definition at line 104 of file tst-eintr1.c.

#define TIMEOUT   3

Definition at line 103 of file tst-eintr1.c.


Function Documentation

static int do_test ( void  ) [static]

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

{
  setup_eintr (SIGUSR1, NULL);

  int i;
  for (i = 0; i < 10; ++i)
    {
      pthread_t th;
      int e = pthread_create (&th, NULL, tf1, NULL);
      if (e != 0)
       {
         char buf[100];
         printf ("main: pthread_create failed: %s\n",
                strerror_r (e, buf, sizeof (buf)));
         exit (1);
       }
    }

  (void) tf1 (NULL);
  /* NOTREACHED */

  return 0;
}

Here is the call graph for this function:

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

Definition at line 38 of file tst-eintr1.c.

{
  while (1)
    {
      pthread_t th;

      int e = pthread_create (&th, NULL, tf2, NULL);
      if (e != 0)
       {
         if (e == EINTR)
           {
             puts ("pthread_create returned EINTR");
             exit (1);
           }

         char buf[100];
         printf ("tf1: pthread_create failed: %s\n",
                strerror_r (e, buf, sizeof (buf)));
         exit (1);
       }

      e = pthread_join (th, NULL);
      if (e != 0)
       {
         if (e == EINTR)
           {
             puts ("pthread_join returned EINTR");
             exit (1);
           }

         char buf[100];
         printf ("tf1: pthread_join failed: %s\n",
                strerror_r (e, buf, sizeof (buf)));
         exit (1);
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

{
  return arg;
}

Here is the caller graph for this function: