]> gitweb.factorcode.org Git - factor.git/blob - basis/concurrency/futures/futures-docs.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / concurrency / futures / futures-docs.factor
1 ! Copyright (C) 2005, 2008 Chris Double, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: concurrency.promises concurrency.messaging kernel arrays
4 continuations help.markup help.syntax quotations calendar ;
5 IN: concurrency.futures
6
7 HELP: future
8 { $values { "quot" { $quotation ( -- value ) } } { "future" future } }
9 { $description "Creates a deferred computation."
10 $nl
11 "The quotation begins with an empty data stack, an empty catch stack, and a name stack containing the global namespace only. This means that the only way to pass data to the quotation is to partially apply the data, for example using " { $link curry } " or " { $link compose } "." } ;
12
13 HELP: ?future-timeout
14 { $values { "future" future } { "timeout" { $maybe duration } } { "value" object } }
15 { $description "Waits for a deferred computation to complete, blocking indefinitely if " { $snippet "timeout" } " is " { $link f } ", otherwise waiting up to the " { $snippet "timeout" } " before throwing an error." }
16 { $errors "Throws an error if the timeout expires before the computation completes. Also throws an error if the future quotation threw an error." } ;
17
18 HELP: ?future
19 { $values { "future" future } { "value" object } }
20 { $description "Waits for a deferred computation to complete, blocking indefinitely." }
21 { $errors "Throws an error if future quotation threw an error." } ;
22
23 ARTICLE: "concurrency.futures" "Futures"
24 "The " { $vocab-link "concurrency.futures" } " vocabulary implements " { $emphasis "futures" } ", which are deferred computations performed in a background thread. A thread may create a future, then proceed to perform other tasks, then later wait for the future to complete."
25 { $subsections
26     future
27     ?future
28     ?future-timeout
29 } ;
30
31 ABOUT: "concurrency.futures"