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.43 by dl, Mon Aug 24 23:08:18 2009 UTC vs.
Revision 1.44 by dl, Tue Aug 25 16:32:28 2009 UTC

# Line 188 | Line 188 | import java.util.concurrent.locks.LockSu
188   * Task class with a constructor accepting a phaser that
189   * it registers for upon construction:
190   *  <pre> {@code
191 < * void build(Task[] actions, int lo, int hi, Phaser b) {
192 < *   int step = (hi - lo) / TASKS_PER_PHASER;
193 < *   if (step > 1) {
194 < *     int i = lo;
195 < *     while (i < hi) {
196 < *       int r = Math.min(i + step, hi);
197 < *       build(actions, i, r, new Phaser(b));
198 < *       i = r;
191 > * void build(Task[] actions, int lo, int hi, Phaser ph) {
192 > *   if (hi - lo > TASKS_PER_PHASER) {
193 > *     for (int i = lo; i < hi; i += TASKS_PER_PHASER) {
194 > *       int j = Math.min(i + TASKS_PER_PHASER, hi);
195 > *       build(actions, i, j, new Phaser(ph));
196   *     }
197   *   } else {
198   *     for (int i = lo; i < hi; ++i)
199 < *       actions[i] = new Task(b);
200 < *       // assumes new Task(b) performs b.register()
199 > *       actions[i] = new Task(ph);
200 > *       // assumes new Task(ph) performs ph.register()
201   *   }
202   * }
203   * // .. initially called, for n tasks via

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines