signal handler problem

Hi All,

Apparently it is not uncommon for signal handlers to "lose or undected" signals once in a while. Does anyone know why this might be and weather the problem may be fixed or at least improved?

Thanks, Antti

Reply to
Antti I.
Loading thread data ...

Signals can be "lost" because each signals state is represented by a signle bit in a processes task control block. Each time the linux scheduler selects a process for execution during a time slice, it first check the signal bits in the TCB and preforms the appropriate action based on the signal state, and the requisite signal masks. Since many other processes may run between any two slices in which a signaled process runs, its possible for the same signal to be sent to a process multiple times before it is processed. Since a single bit records the fact that a signal was sent, any duplicate signals are effectively lost. This isn't really a problem, just a design point you need to code to. If you want to use signals that are queued (so that none are lost), you may want to investigate real time signals. They effectively work the same way regular signals do, but the kernel will queue them for a process so that 2 sent signals cause the signal handler to be called twice. Be careful though, real time signals have their own design pitfalls. Since signal handlers are executed before any other application code in your program, you may find other processes can cripple your program by sending too many signals.

HTH Neil

Reply to
Neil Horman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.