Hi,
I'm writing a server process which spawns child processes via fork
This server process should keep track of the number of children stil
running, do the necessary cleanup to avoid zombies, etc.
In the beginning I thought I had to use the POSIX module, using SigSet
SigAction, sigprocmask etc. for a rather paranoid approach.
Then I've rea
('http://cis.uniroma2.it/guides/perl/pod/perlipc/deferred_signals__safe_signals_.html
(
http://)) that as of perl 5.7.3, perl is safe(r) concerning signa
handling, and I wonder if I can safely go back to using the (mor
convenient) %SIG hash and leaving the rest up to perl.
My major concern is to keep track of the child processes (maintain PID
of living children in a hash, wait for dead children, remove their PID
from the hash). Which I probably could conveniently do with a signa
handler for the SIGCHLD (or is it SIGCLD?) signal.
Two concerns:
I would like to make sure to defer any further signal handling whil
the signal handler itself is active.
And I would like to make sure that child processes do NOT send
SIGCHLD on stop, which I think can be set via something like
Code
-------------------
POSIX::SigAction->new( 'main::catch_sigchld', $sigset_chld, &POSIX::SA_NOCLDSTOP
-------------------
Now my question:
Do the later perl versions automatically defer signals during the tim
the signal handler is executed; and is SA_NOCLDSTOP used by default s
that the handler only gets called if the child is dead, not if i
stops?
In other words, can I rely upon %SIG to install my handlers, or shoul
I use the POSIX module objects/functions?
Thanks,
Steffe
-
steffen staehl
-----------------------------------------------------------------------
Posted via
http://www.codecomments.co
-----------------------------------------------------------------------