Consider the following program where a process father creates a process child , the father should print on the screen 'A' and 'B' , the child writes 'C' and 'D'. The problem is that I want the program to ONLY result with 'ACBD' This is the code :
void main () {
int pid;
signal(SIGUSR1,SIG_IGN);
if (pid=fork()) {
printf("A");
kill(pid,SIGUSR1);
pause();
printf("B");
}
else {
pause();
printf("C");
kill(getppid(),SIGUSR1);
printf("D");
}
}
But its the output is NOTHING ! Any help would be appreciated !