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

Discussion in 'Perl' started by steffen staehle, Sep 7, 2004.

  1. 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
    -----------------------------------------------------------------------
     
    steffen staehle, Sep 7, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. steffen staehle
    Replies:
    0
    Views:
    565
    steffen staehle
    Sep 7, 2004
  2. Michael Pronath
    Replies:
    1
    Views:
    1,237
    Diez B. Roggisch
    Jan 3, 2005
  3. matchstick86

    sig : process vs. process(sig)

    matchstick86, Oct 12, 2009, in forum: VHDL
    Replies:
    1
    Views:
    579
    power_hf2005
    Oct 13, 2009
  4. bob
    Replies:
    0
    Views:
    102
  5. Replies:
    7
    Views:
    109
    Michele Dondi
    Apr 9, 2004
Loading...

Share This Page