Signal Recognition
There are three places a thread checks to see if it has been signaled: at the end of every system call, when it wakes up from a sleep, and after handling a trap of some kind. The routine that checks for signals is issig(). The kernel routines real_sleep(), syscall(), and trap() each call issig() to see if any signals are pending for the thread.
The job of issig() is to determine what signal, if any, should be processed. issig() loops through the bits in p_sig and kt_sig looking for pending signals. If it finds no signals pending, it returns zero. If it finds a signal that is pending, it returns the number of the signal. The signal number is also placed in the thread structure, in kt_cursig.
Although this sounds like a relatively ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access