]> gitweb.factorcode.org Git - factor.git/blob - basis/unix/signals/signals-docs.factor
d423b36f5d15cea6f5f22d53743dc173614b75ef
[factor.git] / basis / unix / signals / signals-docs.factor
1 ! (c)2010 Joe Groff bsd license
2 USING: help.markup help.syntax kernel ;
3 IN: unix.signals
4
5 HELP: add-signal-handler
6 { $values
7     { "handler" { $quotation ( -- ) } } { "sig" "a signal number" }
8 }
9 { $description "Adds a signal handler for " { $snippet "sig" } ". If " { $snippet "sig" } " is raised, the signal handler will be run in a freshly-spawned Factor thread concurrently with any already established signal handlers for " { $snippet "sig" } ". Signal constants are available in the " { $vocab-link "unix.ffi" } " vocabulary." }
10 { $notes "Only certain signals can be handled. See " { $link "unix.signals:allowed-signals" } " for more information. The handler quotation will be run in its own freshly-spawned thread." } ;
11
12 HELP: remove-signal-handler
13 { $values
14     { "handler" { $quotation ( -- ) } } { "sig" "a signal handler" }
15 }
16 { $description "Removes a signal handler for " { $snippet "sig" } ". " { $snippet "handler" } " must be the same quotation object that was passed to " { $link add-signal-handler } ". Signal constants are available in the " { $vocab-link "unix.ffi" } " vocabulary." } ;
17
18 { add-signal-handler remove-signal-handler } related-words
19
20 ARTICLE: "unix.signals:allowed-signals" "Signals that can be handled by Factor"
21 "The following signals can be handled by Factor programs:"
22 { $list "SIGWINCH" "SIGCONT" "SIGURG" "SIGIO" "SIGPROF" "SIGALRM" "SIGVTALRM" "SIGINFO (if available on the host platform)" "SIGUSR1" }
23 "Synchronous signals such as SIGILL, SIGFPE, SIGBUS, and SIGSEGV are handled by the Factor implementation and reported as exceptions when appropriate. SIGUSR2 is used by Factor internally. SIGINT and SIGQUIT are used by Factor to pause the VM and enter into the low-level debugger (like the " { $link die } " word); they cannot yet be handled reliably by Factor code." ;
24
25 ARTICLE: "unix.signals" "Signal handlers"
26 "The " { $vocab-link "unix.signals" } " vocabulary allows Factor applications to handle a limited subset of Unix signals."
27 { $subsection "unix.signals:allowed-signals" }
28 "Factor signal handlers are composable. Adding a signal handler does not replace signal handlers installed by other libraries. Individual signal handlers are added and removed independently with the following words:"
29 { $subsections add-signal-handler remove-signal-handler }
30 ;
31
32 ABOUT: "unix.signals"