Next: , Previous: Automatic C Preprocessor Definitions, Up: Operations

6.2.6 Signals

— Function: init_signals

(in scm.c) initializes handlers for SIGINT and SIGALRM if they are supported by the C implementation. All of the signal handlers immediately reestablish themselves by a call to signal().

— Function: int_signal sig
— Function: alrm_signal sig

The low level handlers for SIGINT and SIGALRM.

If an interrupt handler is defined when the interrupt is received, the code is interpreted. If the code returns, execution resumes from where the interrupt happened. Call-with-current-continuation allows the stack to be saved and restored.

SCM does not use any signal masking system calls. These are not a portable feature. However, code can run uninterrupted by use of the C macros DEFER_INTS and ALLOW_INTS.


sets the global variable ints_disabled to 1. If an interrupt occurs during a time when ints_disabled is 1, then deferred_proc is set to non-zero, one of the global variables SIGINT_deferred or SIGALRM_deferred is set to 1, and the handler returns. — Macro: ALLOW_INTS

Checks the deferred variables and if set the appropriate handler is called.

Calls to DEFER_INTS can not be nested. An ALLOW_INTS must happen before another DEFER_INTS can be done. In order to check that this constraint is satisfied #define CAREFUL_INTS in scmfig.h.