sig_atomic_t - C signal.h

C examples for signal.h:sig_atomic_t

Type

data type

From


<csignal>

Description

Integral type that can be accessed as an atomic entity.

Demo Code


#include <stdio.h>
#include <signal.h>

sig_atomic_t signaled = 0;//from   w w  w. j  a v a  2s.c om

void my_handler (int param){
  signaled = 1;
}

int main (){
  void (*prev_handler)(int);

  prev_handler = signal (SIGINT, my_handler);

  raise(SIGINT);

  printf ("signaled is %d.\n",signaled);

  return 0;
}

Related Tutorials