add-signal-handler ( handler: ( -- ) sig -- )
Signal handlers

Prev:Signals that can be handled by Factor
Next:remove-signal-handler ( handler sig -- )

Vocabulary
unix.signals

Inputs
handlera quotation with stack effect ( -- )
siga signal number
Outputs
None

Word description
Adds a signal handler for sig. If sig is raised, the signal handler will be run in a freshly-spawned Factor thread concurrently with any already established signal handlers for sig. Signal constants are available in the unix.ffi vocabulary.

Notes
Only certain signals can be handled. See Signals that can be handled by Factor for more information. The handler quotation will be run in its own freshly-spawned thread.

See also
remove-signal-handler

Definition