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

Comparing jsr166/src/test/loops/Fib.java (file contents):
Revision 1.7 by jsr166, Thu Jan 15 18:34:19 2015 UTC vs.
Revision 1.8 by dl, Sat Sep 12 18:52:19 2015 UTC

# Line 39 | Line 39 | public final class Fib extends Recursive
39          }
40  
41          for (int reps = 0; reps < 2; ++reps) {
42 <            ForkJoinPool g = (procs == 0) ? new ForkJoinPool() :
42 >            ForkJoinPool g = (procs == 0) ? ForkJoinPool.commonPool() :
43                  new ForkJoinPool(procs);
44              lastStealCount = g.getStealCount();
45              for (int i = 0; i < 20; ++i) {
# Line 48 | Line 48 | public final class Fib extends Recursive
48                  //                    Thread.sleep(100);
49              }
50              System.out.println(g);
51 <            g.shutdown();
52 <            if (!g.awaitTermination(10, TimeUnit.SECONDS))
53 <                throw new Error();
54 <            g = null;
51 >            if (g != ForkJoinPool.commonPool())
52 >                g.shutdown();
53              Thread.sleep(500);
54          }
55      }
# Line 61 | Line 59 | public final class Fib extends Recursive
59  
60      static void test(ForkJoinPool g, int num) throws Exception {
61          int ps = g.getParallelism();
64        //        g.setParallelism(ps);
62          long start = System.nanoTime();
63          Fib f = new Fib(num);
64          g.invoke(f);
# Line 96 | Line 93 | public final class Fib extends Recursive
93              else {
94                  Fib f1 = new Fib(n - 1);
95                  Fib f2 = new Fib(n - 2);
99                //                forkJoin(f1, f2);
96                  invokeAll(f1, f2);
97                  number = f1.number + f2.number;
98              }
# Line 112 | Line 108 | public final class Fib extends Recursive
108          } while (--n > 1);
109          return r;
110      }
111 <
111 >    
112   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines