Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

While the handler in this example does not call signal(), it safely can, since the signal is masked and so the handler can not be interrupted. Note that if the same handler is installed for more than one signal number, it would be necessary to mask the signals explicitly in act.sa_mask in order to ensure the handler can not be interrupted, since the system only masks the signal being delivered.

In fact, POSIX recommends sigaction(2) and deprecates signal(2). Unfortunately, sigaction(2) is not C99-compliant, and is not supported on some platforms, including Windows.

...

Two signals in quick succession can trigger the race condition on non-persistent platforms, thereby causing the signal's default behavior despite a handler's attempt to override it.

...