]> gitweb.factorcode.org Git - factor.git/blob - basis/io/timeouts/timeouts-docs.factor
b2927af362611c60c35bffb6ced30ddbaf5dfb62
[factor.git] / basis / io / timeouts / timeouts-docs.factor
1 IN: io.timeouts\r
2 USING: help.markup help.syntax math kernel calendar ;\r
3 \r
4 HELP: timeout\r
5 { $values { "obj" object } { "dt/f" "a " { $link duration } " or " { $link f } } }\r
6 { $contract "Outputs an object's timeout." } ;\r
7 \r
8 HELP: set-timeout\r
9 { $values { "dt/f" "a " { $link duration } " or " { $link f } } { "obj" object } }\r
10 { $contract "Sets an object's timeout." } ;\r
11 \r
12 HELP: cancel-operation\r
13 { $values { "obj" object } }\r
14 { $contract "Handles a timeout, usually by waking up all threads waiting on the object." } ;\r
15 \r
16 HELP: with-timeout\r
17 { $values { "obj" object } { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } }\r
18 { $description "Applies the quotation to the object. If the object's timeout expires before the quotation returns, " { $link cancel-operation } " is called on the object." } ;\r
19 \r
20 ARTICLE: "io.timeouts" "I/O timeout protocol"\r
21 "Streams, processes and monitors support optional timeouts, which impose an upper bound on the length of time for which an operation on these objects can block. Timeouts are used in network servers to prevent malicious clients from holding onto connections forever, and to ensure that runaway processes get killed."\r
22 { $subsection timeout }\r
23 { $subsection set-timeout }\r
24 "The I/O timeout protocol can be implemented by any class wishing to support timeouts on blocking operations."\r
25 { $subsection cancel-operation }\r
26 "A combinator to be used in operations which can time out:"\r
27 { $subsection with-timeout }\r
28 { $see-also "stream-protocol" "io.launcher" "io.monitors" } ;\r
29 \r
30 ABOUT: "io.timeouts"\r