]> gitweb.factorcode.org Git - factor.git/blob - basis/concurrency/count-downs/count-downs-docs.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / concurrency / count-downs / count-downs-docs.factor
1 USING: help.markup help.syntax sequences ;
2 IN: concurrency.count-downs
3
4 HELP: <count-down>
5 { $values { "n" "a non-negative integer" } { "count-down" count-down } }
6 { $description "Creates a new count-down latch." } 
7 { $errors "Throws an error if the count is lower than zero." } ;
8
9 HELP: count-down
10 { $values { "count-down" count-down } }
11 { $description "Decrements a count-down latch. If it reaches zero, all threads blocking on " { $link await } " are notified." }
12 { $errors "Throws an error if an attempt is made to decrement the count lower than zero." } ;
13
14 HELP: await
15 { $values { "count-down" count-down } }
16 { $description "Waits until the count-down value reaches zero." } ;
17
18 ARTICLE: "concurrency.count-downs" "Count-down latches"
19 "The " { $vocab-link "concurrency.count-downs" } " vocabulary implements the " { $emphasis "count-down latch" } " data type, which is a wrapper for a non-negative integer value which tends towards zero. A thread can either decrement the value, or wait for it to become zero."
20 { $subsections
21     <count-down>
22     count-down
23     await
24 }
25 "The vocabulary was modelled after a similar feature in Java's " { $snippet "java.util.concurrent" } " library." ;
26
27 ABOUT: "concurrency.count-downs"