ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166y/Phaser.java
(Generate patch)

Comparing jsr166/src/jsr166y/Phaser.java (file contents):
Revision 1.38 by dl, Mon Aug 24 12:11:00 2009 UTC vs.
Revision 1.39 by dl, Mon Aug 24 12:15:46 2009 UTC

# Line 35 | Line 35 | import java.util.concurrent.locks.LockSu
35   * #arriveAndAwaitAdvance} has effect analogous to {@link
36   * java.util.concurrent.CyclicBarrier#await CyclicBarrier.await}. Each
37   * generation of a {@code Phaser} has an associated phase number. The
38 < * phase number starts at zero, amd advances when all parties arrive
38 > * phase number starts at zero, and advances when all parties arrive
39   * at the barrier, wrapping around to zero after reaching {@code
40   * Integer.MAX_VALUE}. The use of phase numbers enables independent
41   * control of actions upon arrival at a barrier and upon awaiting
# Line 62 | Line 62 | import java.util.concurrent.locks.LockSu
62   *       the barrier advances to (or is already at) a different phase.
63   *       Unlike similar constructions using {@code CyclicBarrier},
64   *       method {@code awaitAdvance} continues to wait even if the
65 < *       waiting thread is interrupted. (Interruptible and timeout
66 < *       versions are also available.)  Exceptions encountered while
65 > *       waiting thread is interrupted. Interruptible and timeout
66 > *       versions are also available, but exceptions encountered while
67   *       tasks wait interruptibly or with timeout do not change the
68   *       state of the barrier. If necessary, you can perform any
69   *       associated recovery within handlers of those exceptions,
# Line 75 | Line 75 | import java.util.concurrent.locks.LockSu
75   * </ul>
76   *
77   * <p> <b>Termination.</b> A {@code Phaser} may enter a
78 < * <em>termination</em> state in which all actions immediately return
79 < * without updating phaser state or waiting for advance, and
80 < * indicating (via a negative phase value) that execution is complete.
81 < * Termination is triggered when an invocation of {@code onAdvance}
82 < * returns {@code true}.  As illustrated below, when phasers control
83 < * actions with a fixed number of iterations, it is often convenient
84 < * to override this method to cause termination when the current phase
85 < * number reaches a threshold. Method {@link #forceTermination} is
86 < * also available to abruptly release waiting threads and allow them
87 < * to terminate.
78 > * <em>termination</em> state in which all synchronization methods
79 > * immediately return without updating phaser state or waiting for
80 > * advance, and indicating (via a negative phase value) that execution
81 > * is complete.  Termination is triggered when an invocation of {@code
82 > * onAdvance} returns {@code true}.  As illustrated below, when
83 > * phasers control actions with a fixed number of iterations, it is
84 > * often convenient to override this method to cause termination when
85 > * the current phase number reaches a threshold. Method {@link
86 > * #forceTermination} is also available to abruptly release waiting
87 > * threads and allow them to terminate.
88   *
89   * <p> <b>Tiering.</b> Phasers may be <em>tiered</em> (i.e., arranged
90   * in tree structures) to reduce contention. Phasers with large

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines