--- jsr166/src/jsr166e/CountedCompleter.java 2012/10/30 16:05:35 1.6 +++ jsr166/src/jsr166e/CountedCompleter.java 2012/10/31 12:49:13 1.7 @@ -5,6 +5,7 @@ */ package jsr166e; + /** * A {@link ForkJoinTask} with a completion action * performed when triggered and there are no remaining pending @@ -428,18 +429,8 @@ public abstract class CountedCompleter root = a.getRoot(); - Thread thread = Thread.currentThread(); - ForkJoinPool.WorkQueue wq = - (thread instanceof ForkJoinWorkerThread) ? - ((ForkJoinWorkerThread)thread).workQueue : null; - ForkJoinTask t; - while ((t = (wq != null) ? wq.popCC(root) : - ForkJoinPool.popCCFromCommonPool(root)) != null) { - t.doExec(); - if (root.isDone()) - break; - } + if (!(Thread.currentThread() instanceof ForkJoinWorkerThread)) + ForkJoinPool.popAndExecCCFromCommonPool(a); return; } }