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

Comparing jsr166/src/jsr166y/RecursiveAction.java (file contents):
Revision 1.12 by dl, Tue Aug 4 22:47:08 2009 UTC vs.
Revision 1.13 by dl, Fri Oct 30 19:05:57 2009 UTC

# Line 72 | Line 72 | package jsr166y;
72   *  <pre> {@code
73   * double sumOfSquares(ForkJoinPool pool, double[] array) {
74   *   int n = array.length;
75 < *   int seqSize = 1 + n / (8 * pool.getParallelism());
76 < *   Applyer a = new Applyer(array, 0, n, seqSize, null);
75 > *   Applyer a = new Applyer(array, 0, n, null);
76   *   pool.invoke(a);
77   *   return a.result;
78   * }
79   *
80   * class Applyer extends RecursiveAction {
81   *   final double[] array;
82 < *   final int lo, hi, seqSize;
82 > *   final int lo, hi;
83   *   double result;
84   *   Applyer next; // keeps track of right-hand-side tasks
85 < *   Applyer(double[] array, int lo, int hi, int seqSize, Applyer next) {
85 > *   Applyer(double[] array, int lo, int hi, Applyer next) {
86   *     this.array = array; this.lo = lo; this.hi = hi;
87 < *     this.seqSize = seqSize; this.next = next;
87 > *     this.next = next;
88   *   }
89   *
90 < *   double atLeaf(int l, int r) {
90 > *   double atLeaf(int l, int h) {
91   *     double sum = 0;
92   *     for (int i = l; i < h; ++i) // perform leftmost base step
93   *       sum += array[i] * array[i];
# Line 101 | Line 100 | package jsr166y;
100   *     Applyer right = null;
101   *     while (h - l > 1 && getSurplusQueuedTaskCount() <= 3) {
102   *        int mid = (l + h) >>> 1;
103 < *        right = new Applyer(array, mid, h, seqSize, right);
103 > *        right = new Applyer(array, mid, h, right);
104   *        right.fork();
105   *        h = mid;
106   *     }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines