final void helpQuiescePool(WorkQueue w) {
        for (boolean active = true;;) {
            ForkJoinTask<?> localTask; // exhaust local queue
            while ((localTask = w.nextLocalTask()) != null)
                localTask.doExec();
            WorkQueue q = findNonEmptyStealQueue(w);
            if (q != null) {
                ForkJoinTask<?> t; int b;
                if (!active) {      // re-establish active count
                    long c;
                    active = true;
                    do {} while (!U.compareAndSwapLong
                                 (this, CTL, c = ctl, c + AC_UNIT));
                }
                if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null)
                    w.runSubtask(t);
            }
            else {
                long c;
                if (active) {       // decrement active count without queuing
                    active = false;
                    do {} while (!U.compareAndSwapLong
                                 (this, CTL, c = ctl, c -= AC_UNIT));
                }
                else
                    c = ctl;        // re-increment on exit
                if ((int)(c >> AC_SHIFT) + parallelism == 0) {
                    do {} while (!U.compareAndSwapLong
                                 (this, CTL, c = ctl, c + AC_UNIT));
                    break;
                }
            }
        }
    }
final void helpQuiescePool ( WorkQueue w ) { for ( boolean active = true ; ; ) { ForkJoinTask < ? > localTask ; while ( ( localTask = w . nextLocalTask ( ) ) != null ) localTask . doExec ( ) ; WorkQueue q = findNonEmptyStealQueue ( w ) ; if ( q != null ) { ForkJoinTask < ? > t ; int b ; if ( ! active ) { long c ; active = true ; do { } while ( ! U . compareAndSwapLong ( this , CTL , c = ctl , c + AC_UNIT ) ) ; } if ( ( b = q . base ) - q . top < 0 && ( t = q . pollAt ( b ) ) != null ) w . runSubtask ( t ) ; } else { long c ; if ( active ) { active = false ; do { } while ( ! U . compareAndSwapLong ( this , CTL , c = ctl , c -= AC_UNIT ) ) ; } else c = ctl ; if ( ( int ) ( c > > AC_SHIFT ) + parallelism == 0 ) { do { } while ( ! U . compareAndSwapLong ( this , CTL , c = ctl , c + AC_UNIT ) ) ; break ; } } } }
Runs tasks until {@code isQuiescent()}. We piggyback on
active count ctl maintenance, but rather than blocking
when tasks cannot be found, we rescan until all others cannot
find tasks either.