'Using pending signals in a process in C
Have a process which sends a signal to another process (SIGUSR2). This instructs the participant process that it needs to finish up the work it's doing for a previous msg but NOT interrupt it. The logic in the participant is when it's processing the current msg (writing data to a port), it blocks SIGUSR2. Then when the participant is done with the current message, it unblocks SIGUSR2 and it checks if any SIGUSR2 signals are pending. If any are, the signal handler will fire, the code in it executes and all is good.
The problem I'm having is what if 2 or more new pending SIGUSR2 signals hit the participant in rapid-fire succession? The behaviour that I'm seeing is that the 1st one gets picked up and processed but the other ones do not. Note that SIGUSR2 is added in when the handler function is setup so it automatically blocks the signal during processing of received ones.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
