Ignore SIGINT in child process

I am writing a simple program in which the parent and child processes are alternatively printed to a file. I managed to do this using custom signals. Now I want to process the SIGINT signal. After receiving ctrl-c, the parent must send a completion signal to the child, then it must terminate the child, and finally the parent must complete.

My question is that for this work to work correctly, I should receive the SIGINT signal ONLY from the parent, and IGNORE from the child. It is right? If so, are there any hints of this?

+8
c signals
source share
1 answer

Call:

 signal(SIGINT, SIG_IGN); 

from a child process that causes the child process to ignore the SIGINT signal. From man signal :

If the parameter is set to SIG_IGN, then the signal is ignored.

+14
source share

All Articles