Hello guys
Can anyone explain to me why the kill(my_pid,SIGINT) terminates the programm without executing the line sleep(15) but executing only the printf("Finish\n") ?
thank you
Code:#include <stdio.h> #include <unistd.h> #include <sys/socket.h> #include <stdlib.h> void catch_int(int sig_num) { signal(SIGINT, catch_int); printf("interrupt \n"); } int main() { signal(SIGINT, catch_int); int pid; pid_t my_pid = getpid(); printf("HELLO \n"); pid=fork(); if(pid==0) { printf("CHILD \n"); kill(my_pid,SIGINT); exit(1); } sleep(15); printf("Finish\n"); return 0; }



LinkBack URL
About LinkBacks


