diff -r 3510b4bf90ee -r 622c473a21aa jdk/src/share/classes/java/util/concurrent/CountDownLatch.java --- a/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java Fri Oct 26 11:21:02 2012 +0100 +++ b/jdk/src/share/classes/java/util/concurrent/CountDownLatch.java Fri Oct 26 21:34:24 2012 +0100 @@ -34,8 +34,7 @@ */ package java.util.concurrent; -import java.util.concurrent.locks.*; -import java.util.concurrent.atomic.*; +import java.util.concurrent.locks.AbstractQueuedSynchronizer; /** * A synchronization aid that allows one or more threads to wait until @@ -73,7 +72,7 @@ * until all workers have completed. * * - *
+ ** *{@code * class Driver { // ... * void main() throws InterruptedException { * CountDownLatch startSignal = new CountDownLatch(1); @@ -105,9 +104,7 @@ * } * * void doWork() { ... } - * } - * - *+ * }}
Another typical usage would be to divide a problem into N parts, * describe each part with a Runnable that executes that portion and @@ -116,7 +113,7 @@ * will be able to pass through await. (When threads must repeatedly * count down in this way, instead use a {@link CyclicBarrier}.) * - *
+ ** *{@code * class Driver2 { // ... * void main() throws InterruptedException { * CountDownLatch doneSignal = new CountDownLatch(N); @@ -144,9 +141,7 @@ * } * * void doWork() { ... } - * } - * - *+ * }}
Memory consistency effects: Until the count reaches * zero, actions in a thread prior to calling