470,614 Members | 1,430 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

signal handlers: does %SIG{'CLD'} require explicit SA_NOCLDSTOP via POSIX funcs?


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://)) 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
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

In other words, can I rely upon %SIG to install my handlers, or shoul
I use the POSIX module objects/functions?

steffen staehl
Posted via http://www.codecomments.co

Jul 19 '05 #1
0 3146

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by angel | last post: by
11 posts views Thread by Philip Wagenaar | last post: by
7 posts views Thread by Matthew Crouch | last post: by
2 posts views Thread by nephish | last post: by
38 posts views Thread by JTL | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.