/* * Sapmple program for pause system call - No.29 * * pause(2) - wait for signal * * Synopsis * #include * * int pause(void); * * Description * The pause library function causes the invoking process (or * thered) to sleep unitil a signal is received that either * terminates it or causes it to call a signal-catching function. */ #include #include /* signal-catching function */ void sig_alarm(int sig) { printf("SIGALRM\n"); } main() { /* entry signal-catching funtion to the signal-handler table */ signal(SIGALRM, sig_alarm); printf("Waiting\n"); alarm(2); pause(); exit(0); }