Quote:
Originally Posted by
expl
If parent exits while child is still running kernel will send SIGINT to your child that will cause premature termination of it. You either need to call wait() function on the child or implement a better design.
Which system behaves in this way? To my knowledge, no UNIX-like system sends children a signal when their parent dies. The only thing that happens is that the child is adopted by another process (usually PID 1, usually init).
The only behavior similar to that which you've described is when a child uses Linux's prctl(2) with the PR_SET_PDEATHSIG option. This instructs the kernel to send the chosen signal to that child when its parent dies. However, this is not default behavior; it is non-standard; the signal chosen need not be SIGINT; and the signal value is cleared at every fork(2), so even if a child is set to be notified, its children won't be unless they also call prctl(2).
In this thread's particular case, if the child receives a signal because of its parent's death, it'll likely be a SIGPIPE from the child writing to a broken pipe.
Regards,
Alister