Yes, from looking at your code, I think there are some misunderstandings about sigaction and sigprocess masks.

The sigaction structure contains the rules about how a signal is delivered. You can cause it to be ignored, have the default action taken, or have some code that you supply be run. In addition to that you can specifiy a set of signals to block/unblock while your signal handler is running. This is not the same as you setting a sigproc mask at the start of the handler. The sigaction mask will be in effect before even the first instruction in the handler is executed. When the handler finishes the signal blocking mask goes back to whatever it was before the signal.

The C code for a normal setup would look like below. I am more familiar with the C, but there are Perl equivalents if you need to deal with this low of a level.

sigset_t newmask; struct sigaction sa; sa.sa_handler= handler; //handler is name of subroutine sigfillset(&sa.sa_mask); //set up to block all signals sigdelset(&sa.sa_mask, SIGPIPE); // allow SIGPIPE to interrupt handler // normally not done // allowing this is non-typical sa.sa_flags =0; sigaction(SIGUSR1, &sa, NULL);
Sigproc mask is a whole different thing. It is seldom necessary to mess with this. An example usage might be to temporarily block CTL-C, CTL-\ while updating some critical file. Block some signals, do something, unblock signals. This is different than sigaction mask which is the temporary blocking mask that is only in effect for the duration of the signal handler code.

Signals are not queued - the state is a yes/no situation. If a signal is blocked and it happens say 5 times. The result of this is that the state is called "pending". This is a signal that has occurred, but has not yet been delivered. When unblocked, the signal will just be delivered once, not 5 times.


In reply to Re^5: perl threads crashed by Marshall
in thread perl threads crashed by liunx

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.