Back to index

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

Go to the source code of this file.


#define TIMEOUT   3
#define TEST_FUNCTION   do_test ()


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


static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER
static pthread_cond_t c = PTHREAD_COND_INITIALIZER

Define Documentation


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

#define TEST_FUNCTION   do_test ()

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

#define TIMEOUT   3

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

Function Documentation

static int do_test ( void  ) [static]

Definition at line 56 of file tst-eintr5.c.

  setup_eintr (SIGUSR1, NULL);

  pthread_t th;
  char buf[100];
  int e = pthread_create (&th, NULL, tf, NULL);
  if (e != 0)
      printf ("main: pthread_create failed: %s\n",
             strerror_r (e, buf, sizeof (buf)));
      exit (1);

  /* This call must never return.  */
  e = pthread_cond_wait (&c, &m);
  printf ("main: cond_wait returned: %s\n",
         strerror_r (e, buf, sizeof (buf)));

  return 0;

Here is the call graph for this function:

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

Definition at line 36 of file tst-eintr5.c.

  struct timespec ts;
  struct timeval tv;

  gettimeofday (&tv, NULL);
  ts.tv_sec += 10000;

  /* This call must never return.  */
  int e = pthread_cond_timedwait (&c, &m, &ts);
  char buf[100];
  printf ("tf: cond_timedwait returned: %s\n",
         strerror_r (e, buf, sizeof (buf)));

  exit (1);

Here is the call graph for this function:

Variable Documentation

Definition at line 32 of file tst-eintr5.c.

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