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

Comparing jsr166/src/test/loops/SpinningTieredPhaserLoops.java (file contents):
Revision 1.3 by jsr166, Mon Nov 2 23:42:46 2009 UTC vs.
Revision 1.4 by dl, Tue Nov 3 12:37:26 2009 UTC

# Line 23 | Line 23 | public class SpinningTieredPhaserLoops {
23      static int tasksPerPhaser = Math.max(NCPUS / 4, 4);
24  
25      static void build(Runnable[] actions, int sz, int lo, int hi, Phaser b) {
26 <        int step = (hi - lo) / tasksPerPhaser;
27 <        if (step > 1) {
28 <            int i = lo;
29 <            while (i < hi) {
30 <                int r = Math.min(i + step, hi);
31 <                build(actions, sz, i, r, new Phaser(b));
32 <                i = r;
26 >        if (hi - lo > tasksPerPhaser) {
27 >            for (int i = lo; i < hi; i += tasksPerPhaser) {
28 >                int j = Math.min(i + tasksPerPhaser, hi);
29 >                build(actions, sz, i, j, new Phaser(b));
30              }
31 <        }
35 <        else {
31 >        } else {
32              for (int i = lo; i < hi; ++i)
33                  actions[i] = new PhaserAction(i, b, sz);
34          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines