in reply to Re: Could not catch all children after fork, some of them never end
in thread Could not catch all children after fork, some of them never end

I thought its a fork so everything should be cloned until this position and every child should get the SIG INT (the sig handler is defined before the fork) or am I wrong? Because the text msg (print cmd in sig handler) shows up for every single child and even some childs are finishing as expected after pressing ctrl-c.

  • Comment on Re^2: Could not catch all children after fork, some of them never end

Replies are listed 'Best First'.
Re^3: Could not catch all children after fork, some of them never end
by educated_foo (Vicar) on Mar 13, 2013 at 14:40 UTC
    I think I may have oversimplified in my answer. I know that when you press control-c, the signal is delivered to the process currently attached to the terminal. Maybe the children take over from the parent when it exits if you didn't close STDIN and STDOUT before forking, but I would have to look it up and play around a bit to figure out exactly what happens. Sorry.