Back to index

glibc  2.9
Defines | Functions
tst-sem2.c File Reference
#include <errno.h>
#include <semaphore.h>
#include <signal.h>
#include <stdio.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 int do_test (void)

Define Documentation

#define EXPECTED_SIGNAL   SIGALRM

Definition at line 52 of file tst-sem2.c.

#define TEST_FUNCTION   do_test ()

Definition at line 53 of file tst-sem2.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 28 of file tst-sem2.c.

{
  sem_t s;

  if (sem_init (&s, 0, 0) == -1)
    {
      puts ("init failed");
      return 1;
    }

  /* Set an alarm for 1 second.  The wrapper will expect this.  */
  alarm (1);

  if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1)
    {
      puts ("wait failed");
      return 1;
    }

  /* We should never get here.  */
  puts ("wait succeeded");
  return 1;
}

Here is the call graph for this function: