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

Comparing jsr166/src/main/java/util/concurrent/CyclicBarrier.java (file contents):
Revision 1.40 by jsr166, Thu Apr 14 23:05:50 2011 UTC vs.
Revision 1.41 by jsr166, Thu Jun 9 07:48:43 2011 UTC

# Line 23 | Line 23 | import java.util.concurrent.locks.*;
23   *
24   * <p><b>Sample usage:</b> Here is an example of
25   *  using a barrier in a parallel decomposition design:
26 < * <pre>
26 > *
27 > *  <pre> {@code
28   * class Solver {
29   *   final int N;
30   *   final float[][] data;
# Line 61 | Line 62 | import java.util.concurrent.locks.*;
62   *
63   *     waitUntilDone();
64   *   }
65 < * }
66 < * </pre>
65 > * }}</pre>
66 > *
67   * Here, each worker thread processes a row of the matrix then waits at the
68   * barrier until all rows have been processed. When all rows are processed
69   * the supplied {@link Runnable} barrier action is executed and merges the
# Line 76 | Line 77 | import java.util.concurrent.locks.*;
77   * {@link #await} returns the arrival index of that thread at the barrier.
78   * You can then choose which thread should execute the barrier action, for
79   * example:
80 < * <pre>  if (barrier.await() == 0) {
81 < *     // log the completion of this iteration
82 < *   }</pre>
80 > *  <pre> {@code
81 > * if (barrier.await() == 0) {
82 > *   // log the completion of this iteration
83 > * }}</pre>
84   *
85   * <p>The <tt>CyclicBarrier</tt> uses an all-or-none breakage model
86   * for failed synchronization attempts: If a thread leaves a barrier

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines