chickadee » chicken » process » signal » make-signal-handler

make-signal-handler SIGNUM ...procedure

Establishes a handler for the POSIX signals with the numbers SIGNUM ... and returns a procedure of zero or one argument. Should one of the given signals be raised, then it will be stored in a queue. Invoking the procedure returned by make-signal-handler with zero arguments or with the argument #f will remove the oldest entry in the queue and return it to the caller. Invoking the procedure with argument #t when no signal was raised since the creation of the signal handler or the most recent call to the handler will result in suspending the execution until one of the signals given in SIGNUM ... occurs.

Notes:

  • 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
  • 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.