C examples for signal.h:sig_atomic_t
data type
<csignal>
Integral type that can be accessed as an atomic entity.
#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; }