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.
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.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);
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |