Next: Programming with signal handling in mind, Previous: The deferral mechanism, Up: Signal handling
Sending and receiving the same number of signals is crucial for
INTERRUPT-THREAD
and sig_stop_for_gc
, hence they are
real-time signals for which the kernel maintains a queue as opposed to
just setting a flag for “sigint pending”.
Note, however, that the rt signal queue is finite and on current linux
kernels a system wide resource. If the queue is full, SBCL tries to
signal until it succeeds. This behaviour can lead to deadlocks, if a
thread in a WITHOUT-INTERRUPTS
is interrupted many times,
filling up the queue and then a gc hits and tries to send
SIG_STOP_FOR_GC
.
Signal handlers should automatically restore errno and fp state. Currently, this is not the case.
Furthormore, while arrange_return_to_lisp_function
exits, most
signal handlers invoke unsafe functions without hesitation: gc and all
lisp level handlers think nothing of it.