ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/CountDownLatch.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/CountDownLatch.java (file contents):
Revision 1.8 by tim, Sat Aug 23 19:46:15 2003 UTC vs.
Revision 1.9 by dholmes, Mon Aug 25 22:28:11 2003 UTC

# Line 12 | Line 12 | import java.util.concurrent.locks.*;
12   * a set of operations being performed in other threads completes.
13   *
14   * <p>A <tt>CountDownLatch</tt> is initialized with a given
15 < * <em>count</em>.  The {@link #await} methods block until the current
15 > * <em>count</em>.  The {@link #await await} methods block until the current
16   * {@link #getCount count} reaches zero due to invocations of the
17   * {@link #countDown} method, after which all waiting threads are
18 < * released and any subsequent invocations of {@link #await} return
18 > * released and any subsequent invocations of {@link #await await} return
19   * immediately. This is a one-shot phenomenon -- the count cannot be
20   * reset.  If you need a version that resets the count, consider using
21   * a {@link CyclicBarrier}.
# Line 23 | Line 23 | import java.util.concurrent.locks.*;
23   * <p>A <tt>CountDownLatch</tt> is a versatile synchronization tool
24   * and can be used for a number of purposes.  A
25   * <tt>CountDownLatch</tt> initialized with a count of one serves as a
26 < * simple on/off latch, or gate: all threads invoking {@link #wait}
26 > * simple on/off latch, or gate: all threads invoking {@link #await await}
27   * wait at the gate until it is opened by a thread invoking {@link
28   * #countDown}.  A <tt>CountDownLatch</tt> initialized to <em>N</em>
29   * can be used to make one thread wait until <em>N</em> threads have
# Line 31 | Line 31 | import java.util.concurrent.locks.*;
31   * <p>A useful property of a <tt>CountDownLatch</tt> is that it
32   * doesn't require that threads calling <tt>countDown</tt> wait for
33   * the count to reach zero before proceeding, it simply prevents any
34 < * thread from proceeding past the {@link #await wait} until all
34 > * thread from proceeding past an {@link #await await} until all
35   * threads could pass.
36   *
37   * <p><b>Sample usage:</b> Here is a pair of classes in which a group
38   * of worker threads use two countdown latches:
39   * <ul>
40 < * <li> The first is a start signal that prevents any worker from proceeding
40 > * <li>The first is a start signal that prevents any worker from proceeding
41   * until the driver is ready for them to proceed;
42 < * <li> The second is a completion signal that allows the driver to wait
42 > * <li>The second is a completion signal that allows the driver to wait
43   * until all workers have completed.
44   * </ul>
45   *
# Line 152 | Line 152 | public class CountDownLatch {
152       * the current thread becomes disabled for thread scheduling
153       * purposes and lies dormant until one of two things happen:
154       * <ul>
155 <     * <li> The count reaches zero due to invocations of the
155 >     * <li>The count reaches zero due to invocations of the
156       * {@link #countDown} method; or
157 <     * <li> Some other thread {@link Thread#interrupt interrupts} the current
157 >     * <li>Some other thread {@link Thread#interrupt interrupts} the current
158       * thread.
159       * </ul>
160       * <p>If the current thread:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines