chickadee » posix » set-signal-handler!

set-signal-handler! SIGNUM PROCprocedure

Establishes the procedure of one argument PROC as the handler for the signal with the code SIGNUM. PROC is called with the signal number as its sole argument. If the argument PROC is #f then any signal handler will be removed, and the corresponding signal set to SIG_IGN.

Notes

  • it is unspecified in which thread of execution the signal handler will be invoked.
  • when signals arrive in quick succession (specifically, before the handler for a signal has been started), then signals will be queued (up to a certain limit); the order in which the queued signals will be handled is not specified
  • (set! (signal-handler SIG) PROC) can be used as an alternative to (set-signal-handler! SIG PROC)
  • Any signal handlers for the signals signal/segv, signal/bus, signal/fpe and signal/ill will be ignored and these signals will always trigger an exception, unless the executable was started with the -:S runtime option. This feature is only available on platforms that support the sigprocmask(3) POSIX API function.