Signals
structureSignals provides an interface to signal system.
signature SIGNALS
structure Signals
: SIGNALS
eqtype signal
datatype sig_action
= IGNORE
| DEFAULT
| HANDLER of (signal * int * unit cont) -> unit cont
val listSignals : unit -> signal list
val toString : signal -> string
val fromString : string -> signal option
val setHandler : (signal * sig_action) -> sig_action
val overrideHandler : (signal * sig_action) -> sig_action
val inqHandler : signal -> sig_action
datatype sigmask
= MASKALL
| MASK of signal list
val maskSignals : sigmask -> unit
val unmaskSignals : sigmask -> unit
val masked : unit -> sigmask
val pause : unit -> unit
val sigINT : signal
val sigALRM : signal
val sigTERM : signal
val sigGC : signal
eqtype signal
datatype sig_action
listSignals ()
map toString (listSignals())
to see their names.
toString signal
fromString s
NONE
if there is no such signal.
The structure UnixSignals defines several of these signal values, so that you need not suffer the indignity and insecurity of using fromString to look them up.
setHandler (signal, IGNORE)
setHandler (signal, DEFAULT)
setHandler (signal, HANDLER(f))
DEFAULT tells the operating system to perform the default action for signal.
HANDLER(f) installs a handler for a signal. When signal is delivered to the process, the execution state of the current thread will be bundled up as a continuation k
, then f(signal,n
,k
) will be called. The number n
is the number of times signal has been signalled since the last time f was invoked for it. During the execution of f, all signals are held (not delivered). When f returns some continuation k'
, signals are re-enabled, and then k'
is invoked.
overrideHandler (signal, handler)
inqHandler signal
datatype sigmask
maskSignals sigs
unmaskSignals sigs
masked ()
MASK[]
means that no signals are masked.
pause ()
sigINT
sigALRM
sigTERM
sigGC