2008-02-18 17:20:18 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								USING:  help.markup  help.syntax  sequences  ;
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								IN:  concurrency.count-downs  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  <count-down>  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  "a non-negative integer"  } { "count-down"  count-down } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Creates a new count-down latch."  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $errors "Throws an error if the count is lower than zero."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  count-down  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "count-down"  count-down } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Decrements a count-down latch. If it reaches zero, all threads blocking on "  { $link await } " are notified."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $errors "Throws an error if an attempt is made to decrement the count lower than zero."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  await  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "count-down"  count-down } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Waits until the count-down value reaches zero."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "concurrency.count-downs"  "Count-down latches" 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-26 19:20:31 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"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."  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    <count-down>
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    count-down
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    await
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2008-07-03 02:39:45 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								"The vocabulary was modelled after a similar feature in Java's "  { $snippet "java.util.concurrent"  } " library."  ;
  
						 
					
						
							
								
									
										
										
										
											2008-02-18 17:20:18 -05:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ABOUT: "concurrency.count-downs"