Yes, indeed!

The daemon will blocked the SIGHUP signal when it execute the SIGHUP handler. And after it relaunch itself in the handler, the SIGHUP remains being blocked, so the SIGHUP sent later is pending.

Put the following code at the head of the scrpit:

my $emptySigSet = POSIX::SigSet->new(); my $oldSigSet = POSIX::SigSet->new(); POSIX::sigprocmask( &POSIX::SIG_BLOCK, $emptySigSet, $oldSigSet ); if ( $oldSigSet->ismember( &POSIX::SIGHUP ) ){ print "SIGHUP is blocking.\n"; }else { print "SIGHUP is not blocking.\n"; }

And replace the old hupMain with the following new one:

sub hupMain { while (1) { print "Running hup main function.\n"; sleep 3; my $pendingSigSet = POSIX::SigSet->new(); POSIX::sigpending( $pendingSigSet ) ; if ( $pendingSigSet->ismember( &POSIX::SIGHUP ) ){ print "Pending signal set contains SIG_HUP\n"; } } }

I can observe the SIGHUP signal is being blocking and pending.


In reply to Re^2: Why this daemon can only receive the HUP signal no more than one time? by sunshine_august
in thread Why this daemon can only receive the HUP signal no more than one time? by sunshine_august

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.