from: https://www.cnblogs.com/kex1n/p/8296623.html
1. sigprocmask provides shielding function and the release function of the mask signal.
Run in order to achieve the key code is not interrupted.
Function declaration as follows:
int sigprocmask (int how, const sigset_t * set, sigset_t * oldset);
wherein the parameters may be set for how the parameters: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK
SIG_BLOCK:
in accordance with the mask word supplied parameter set, the mask signal. And the original signal is saved to oldset the shield.
SIG_UNBLOCK:
a signal according to parameters set to provide the mask character unmasked. Set in de screen for a signal.
SIG_SETMASK:
a signal provided by the setting parameter set signal provided to reset the system.
2. implement solutions to common signal shielding screen
method: implemented SIG_BLOCK, SIG_UNBLOCK pair
advantages oldset can be whatever.
Method two:
SIG_BLOCK a shield, arranged to save the original signal.
SIG_SETMASK restore the original settings.
3. How shield during the received signal processing
in the signal masking process, all signals are shielded arise, no matter how many times occur in the signal unmasked, the system will perform a masked operation on the signal.