]> gitweb.factorcode.org Git - factor.git/blob - basis/alarms/alarms-docs.factor
dac8b72dd50d78260663471b288e917ad10d7b6e
[factor.git] / basis / alarms / alarms-docs.factor
1 IN: alarms\r
2 USING: help.markup help.syntax calendar quotations ;\r
3 \r
4 HELP: alarm\r
5 { $class-description "An alarm. Can be passed to " { $link cancel-alarm } "." } ;\r
6 \r
7 HELP: add-alarm\r
8 { $values { "quot" quotation } { "time" timestamp } { "frequency" "a " { $link duration } " or " { $link f } } { "alarm" alarm } }\r
9 { $description "Creates and registers an alarm. If " { $snippet "frequency" } " is " { $link f } ", this will be a one-time alarm, otherwise it will fire with the given frequency. The quotation will be called from the alarm thread." } ;\r
10 \r
11 HELP: later\r
12 { $values { "quot" quotation } { "duration" duration } { "alarm" alarm } }\r
13 { $description "Creates and registers an alarm which calls the quotation once at " { $snippet "time" } " from now." } ;\r
14 \r
15 HELP: cancel-alarm\r
16 { $values { "alarm" alarm } }\r
17 { $description "Cancels an alarm. Does nothing if the alarm is not active." } ;\r
18 \r
19 HELP: every\r
20 { $values\r
21      { "quot" quotation } { "duration" duration }\r
22      { "alarm" alarm } }\r
23 { $description "Creates and registers an alarm which calls the quotation repeatedly, using " { $snippet "dt" } " as the frequency." } ;\r
24 \r
25 ARTICLE: "alarms" "Alarms"\r
26 "The " { $vocab-link "alarms" } " vocabulary provides a lightweight way to schedule one-time and recurring tasks without spawning a new thread."\r
27 { $subsection alarm }\r
28 { $subsection add-alarm }\r
29 { $subsection later }\r
30 { $subsection cancel-alarm }\r
31 "Alarms do not persist across image saves. Saving and restoring an image has the effect of calling " { $link cancel-alarm } " on all " { $link alarm } " instances." ;\r
32 \r
33 ABOUT: "alarms"\r