Linux man page中提到：
The behavior of signal() varies across Unix versions, and has also varied
historically across different versions of Linux. Avoid its use: use sigaction(2) instead.
The only portable use of signal() is to set a signal’s disposition to SIG_DFL or SIG_IGN. The semantics when using signal() to establish a signal handler vary across systems (and POSIX.1 explicitly permits this variation); do not use it for this purpose.
When a signal is caught by a signal-catching function installed by
sigaction(), a new signal mask is calculated and installed for the
duration of the signal-catching function (or until a call to either
sigprocmask() or sigsuspend() is made). This mask is formed by taking
the union of the current signal mask and the value of the sa_mask for
the signal being delivered unless SA_NODEFER or
SA_RESETHAND is set, And then including the signal being
delivered. If and when the user’s signal handler returns normally, the
original signal mask is restored.