There are two varieties of signals available, named and anonymous.
A named signal is one for which we have a symbolic name, such as kill
or pipe.
Anonymous signals, for which we only have the current operating system's
signal number, have no meaning in other operating systems.
Named signals preserve their meaning in image files.
Not all named signals are available from all OS's and
there may be multiple names for a single OS signal number.
(signal | syntax |
(name->signal symbol) -> signal or #f
(integer->signal integer) -> signal
(signal? x) -> boolean
(signal-name signal) -> symbol or #f
(signal-os-number signal) -> integer
(signal=? signal0 signal1) -> boolean
signal returns a (named) signal associated with
signal-name.
Name->signal returns a (named) signal or #f if the
the signal name is not supported by the operating system.
The signal returned by integer->signal is a named signal if
integer corresponds to a named signal in the current operating
system; otherwise it returns an anonymous signal.
Signal-name returns a symbol if signal is named and
#f if it is anonymous.
Signal=? returns #t if signal0 and signal1
have the same operating system number and #f if they do not.
abrtabort - abnormal termination (as by abort()) alrmalarm - timeout signal (as by alarm()) fpefloating point exception huphangup - hangup on controlling terminal or death of controlling process illillegal instruction intinterrupt - interaction attention killkill - termination signal, cannot be caught or ignored pipepipe - write on a pipe with no readers quitquit - interaction termination segvsegmentation violation - invalid memory reference termtermination - termination signal usr1user1 - for use by applications usr2user2 - for use by applications chldchild - child process stopped or terminated contcontinue - continue if stopped stopstop - cannot be caught or ignored tstpinteractive stop ttinread from control terminal attempted by background process ttouwrite to control terminal attempted by background process busbus error - access to undefined portion of memory
traptrace or breakpoint trap iotIOT trap - a synonym for ABRT emtsysbad argument to routine (SVID) stkfltstack fault on coprocessor urgurgent condition on socket (4.2 BSD) ioI/O now possible (4.2 BSD) pollA synonym for SIGIO (System V) cldA synonym for SIGCHLD xcpuCPU time limit exceeded (4.2 BSD) xfszFile size limit exceeded (4.2 BSD) vtalrmVirtual alarm clock (4.2 BSD) profProfile alarm clock pwrPower failure (System V) infoA synonym for SIGPWR lostFile lock lost winchWindow resize signal (4.3 BSD, Sun) unusedUnused signal
signal to the process corresponding to process-id.
Signals received by the Scheme process can be obtained via one or more signal-queues. Each signal queue has a list of monitored signals and a queue of received signals that have yet to be read from the signal-queue. When the Scheme process receives a signal that signal is added to the received-signal queues of all signal-queues which are currently monitoring that particular signal.
(make-signal-queue signals) -> signal-queue
(signal-queue? x) -> boolean
(signal-queue-monitored-signals signal-queue) -> list of signals
(dequeue-signal! signal-queue) -> signal
(maybe-dequeue-signal! queue-queue) -> signal or #f
Make-signal-queue returns a new signal-queue that will monitor
the signals in the list signals.
Signal-queue? is a predicate for signal queues.
Signal-queue-monitored-signals returns a list of the signals
currently monitored by signal-queue.
Dequeue-signal! and maybe-dequeue-signal both return
the next received-but-unread signal from signal-queue.
If signal-queue's queue of signals is empty dequeue-signal!
blocks until an appropriate signal is received.
Maybe-dequeue-signal! does not block; it returns #f instead.
There is a bug in the current system that causes an erroneous deadlock error if threads are blocked waiting for signals and no other threads are available to run. A work around is to create a thread that sleeps for a long time, which prevents any deadlock errors (including real ones):
> ,open threads
> (spawn (lambda ()
; Sleep for a year
(sleep (* 1000 60 60 24 365))))
These two procedures can be used to add or remove signals from a
signal-queue's list of monitored signals.
When a signal is removed from a signal-queue's list of monitored signals
any occurances of the signal are removed from that signal-queue's pending
signals.
In other words, dequeue-signal! and maybe-dequeue-signal!
will only return signals that are currently on the signal-queue's list
of signals.