send signal from parent process to child in C
问题 My child proccess can't start to work. I need to pass signal and execute readUsual function. This is a small piece of code: int main() { pid_t pid2 = fork(); if (pid2 < 0) printf("Can't create child process\n"); else if (pid2==0) { //this block never execute printf("Process2, pid=%d\n",getpid()); signal(SIGUSR1,readUsual); } else { kill(pid2,SIGUSR1); printf("%s\n","Proccess1 end"); for(;;); } return 0; } 回答1: You need to either add synchronization in some way, or call signal() before your