#include <stdio.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> void handler(int n) { printf("I'm melting ....\n"); exit(0); } int main(int argc, char* argv[]) { int n = 0; signal(SIGALRM, handler); alarm(2); while(1) { printf("."); if ( ++n % 30 == 0 ) { printf("\n%d ", n); } } return 0; }
- How does this program terminate? or does it?
- Who sends the SIGALRM signal to this process?