7.3 sigaction

If your program needs to specify its own handler, the proper method is to use sigaction.

This function has three parameters:

struct sigaction is a structure that consists of many attributes:

7.3.1 Why the complication?

Compared to signal, sigaction is a bit more complex to use. However, this is not without reasons.

First of all, the sa_mask field of struct sigaction allows the specification of whether the handling of a particular signal can block other signals (including another instance of itself!) from interrupting it. This is very important when it comes to variable consistency.