Hi
i need explanation ... how it is possible this:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/wait.h>
void handler_readPipe(int sig)
{
printf("I have signal ... \n");
}
int main ()
{
int pid = fork();
if(pid == -1)
{
return -1;
}
if(pid == 0)
{
sleep(5);
kill(getppid(), SIGUSR1);
}
else
{
struct sigaction sa;
sa.sa_handler = &handler_readPipe;
sa.sa_flags = SA_RESTART;
sigaction( SIGUSR1, &sa, NULL );
sleep(10);
printf("Message affter kill\n");
}
return(0);
}
How it is possible, if I kill a parent from a child, the process will run to the end anyway ... how is it possible to execute the line: printf ("Message affter kill \ n");
Code:
I have signal ...
Message affter kill