Back to index

glibc  2.9
Functions | Variables
sigh1.c File Reference
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

void catch_alarm (int sig)
void do_stuff (void)
int main (void)

Variables

volatile sig_atomic_t keep_going = 1

Function Documentation

void catch_alarm ( int  sig)

Definition at line 10 of file sigh1.c.

Here is the caller graph for this function:

void do_stuff ( void  )

Definition at line 17 of file sigh1.c.

{
  puts ("Doing stuff while waiting for alarm....");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( void  )

Definition at line 23 of file sigh1.c.

{
  /* Establish a handler for SIGALRM signals. */
  signal (SIGALRM, catch_alarm);

  /* Set an alarm to go off in a little while. */
  alarm (2);

  /* Check the flag once in a while to see when to quit. */
  while (keep_going)
    do_stuff ();

  return EXIT_SUCCESS;
}

Here is the call graph for this function:


Variable Documentation

volatile sig_atomic_t keep_going = 1

Definition at line 6 of file sigh1.c.