Remember: signals come from the OS. The kernel decides a signal is pending for your process or thread, and when your code gets CPU time again, delivery happens according to the handling rules you previously told the OS to use.
Almost every signal-related function is a variation of: “kernel, for signal X, do Y.”
sigaction()
Register with the OS that you want a specific way of handling a signal, such as running your handler function, ignoring it, or restoring default behavior.sigemptyset(): Clear set