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

Comparing jsr166/src/test/loops/DynamicFib.java (file contents):
Revision 1.1 by dl, Sun Sep 19 12:55:36 2010 UTC vs.
Revision 1.2 by jsr166, Mon Sep 20 20:42:37 2010 UTC

# Line 21 | Line 21 | public final class DynamicFib extends Re
21              return;
22          }
23          for (int reps = 0; reps < 2; ++reps) {
24 <            ForkJoinPool pool = procs == 0? new ForkJoinPool() :
24 >            ForkJoinPool pool = procs == 0? new ForkJoinPool() :
25                  new ForkJoinPool(procs);
26 <            for (int i = 0; i < 20; ++i)
26 >            for (int i = 0; i < 20; ++i)
27                  test(pool, num);
28              System.out.println(pool);
29              pool.shutdown();
# Line 51 | Line 51 | public final class DynamicFib extends Re
51  
52      int number;     // Initialized with argument; replaced with result
53      DynamicFib(int n) { number = n; }
54 <    public void compute() {
55 <        number = fib(number);
54 >    public void compute() {
55 >        number = fib(number);
56      }
57  
58      static int fib(int n) {
59          int res;
60 <        if (n <= 1)
60 >        if (n <= 1)
61              res = n;
62          else if (getSurplusQueuedTaskCount() >= 4)
63              res = seqFib(n);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines