I have this issue with signals being lost. I mean I have this system, where signals are generated by child processes and received by other child processes of a parent process. I have used sigwait and sigprocmask to actually block and then wait for signals inside the signal receiving child processes rather than registering an asynchronous handler.
Now when I run this system. I can see that initially, the generated signals from the child processes are blocked by the receiving child processes and then using sigwait they actually process these pending signals. So the signals are pending and then fetched using sigwait and it goes on.
But as the time passes, I could see that signals are not consumed as much as before. I mean there are lots of signals generated and they are not being processed by the receiving processes. Is it possible that if I have lots of signals pending then it could result in the signals being lost?
Only real-time signals (those between
SIGRTMINandSIGRTMAX), if your OS supports them, are guaranteed to be queued (up to a maximum ofSIGQUEUE_MAXqueued signals). Other signals may be lost if the receiving process already has a pending signal with the same code.From the specification for
sigaction: