/** * Possibly executes tasks until the pool hosting the current task * {@link ForkJoinPool#isQuiescent is quiescent}. This method may * be of use in designs in which many tasks are forked, but none * are explicitly joined, instead executing them until all are * processed. */ public static void helpQuiesce() { Thread t; if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) { ForkJoinWorkerThread wt = (ForkJoinWorkerThread)t; wt.pool.helpQuiescePool(wt.workQueue); } else ForkJoinPool.quiesceCommonPool(); }
if ((thread instanceof ForkJoinWorkerThread) && (wt = (ForkJoinWorkerThread)thread).pool == this) { helpQuiescePool(wt.workQueue); return true;