#include #include #include #include #include #define LOOP_LIMIT 1E6 volatile int sigcount=0; void catcher( int sig ) { printf( "Signal catcher called for signal %d\n", sig ); sigcount = 1; } int main( int argc, char *argv[] ) { struct sigaction sact; volatile double count; time_t t; sigemptyset( &sact.sa_mask ); // set up the parameters for the alarm sact.sa_flags = 0; sact.sa_handler = catcher; sigaction( SIGALRM, &sact, NULL ); // specifying the alarm and handler alarm(1); /* timer will pop in 5 ms */ time( &t ); printf( "Before loop, time is %s", ctime(&t) ); for( count=0; ((count