in reply to Re^2: Best way to kill a child process
in thread Best way to kill a child process
Yes, on some platforms, setting up the sigaction stuff to a NULL handler will cause an "auto reap", but AFAIK that is not universal - I'm thinking about the low level C calls that Perl would use. In this case, this is an issue of how the OS deals with sigaction() handlers, not how Perl itself works. Perl cannot do what C cannot do.use IO::Socket; use POSIX ":sys_wait_h";
I guess where I'm at is that the code I suggested is going to work on all platforms all the time (AFIK). I agree that 'IGNORE' will work on almost all platforms. I'm just not sure about the difference between "almost all" and "all". This detail probably doesn't matter for this app - it doesn't sound like a "general purpose" application as far as the OP is concerned.
So YMMV. Setting "IGNORE" is not "wrong" and it is "easier".
We both agree on the main issue here:
that the right way to deal with this is to explicitly do something with the CHLD signal: either a) explicitly ignore it which hopefully will cause the OS to "autoreap" the child or b)set a simple subroutine like I suggested. As long as one of these options "works", then it will work in all cases of child death: a) if the child kills itself (maybe a via a die statement) or b)I kill my own child or c)somebody else kills it.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Best way to kill a child process
by Eliya (Vicar) on Sep 21, 2011 at 18:41 UTC | |
by Marshall (Canon) on Sep 22, 2011 at 00:50 UTC | |
by flexvault (Monsignor) on Oct 10, 2011 at 15:16 UTC | |
by Marshall (Canon) on Oct 15, 2011 at 21:18 UTC | |
by flexvault (Monsignor) on Oct 16, 2011 at 13:28 UTC | |
|