ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ForkJoinPool.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ForkJoinPool.java (file contents):
Revision 1.398 by dl, Thu Feb 18 12:38:51 2021 UTC vs.
Revision 1.399 by dl, Sat Feb 20 14:01:18 2021 UTC

# Line 492 | Line 492 | public class ForkJoinPool extends Abstra
492       * terminate others by cancelling their unprocessed tasks, and
493       * waking them up. Calls to non-abrupt shutdown() preface this by
494       * checking isQuiescent before triggering the "STOP" phase of
495 <     * termination.
495 >     * termination. To conform to ExecutorService invoke, invokeAll,
496 >     * and invokeAny specs, we must track pool status while waiting,
497 >     * and interrupt interruptable callers on termination (see
498 >     * ForkJoinTask.joinForPoolInvoke etc).
499       *
500       * Joining Tasks
501       * =============
# Line 602 | Line 605 | public class ForkJoinPool extends Abstra
605       * amounts to an odd form of limited spin-wait before blocking in
606       * ForkJoinTask.join.
607       *
608 +     * Guarantees for common pool parallelism zero are limited to
609 +     * tasks that are joined by their callers in a tree-structured
610 +     * fashion or use CountedCompleters (as is true for jdk
611 +     * parallelStreams). Support infiltrates several methods,
612 +     * including those that retry helping steps until we are sure that
613 +     * none apply if there are no workers.
614 +     *
615       * As a more appropriate default in managed environments, unless
616       * overridden by system properties, we use workers of subclass
617       * InnocuousForkJoinWorkerThread when there is a SecurityManager
# Line 2113 | Line 2123 | public class ForkJoinPool extends Abstra
2123                      lock.unlock();
2124                  }
2125              }
2126 <            else if (q.tryLock())
2117 <                return q;
2118 <            else if ((md & SMASK) != 0)             // move unless no parallelism
2126 >            else if (!q.tryLock())                  // move and restart
2127                  id = (r = ThreadLocalRandom.advanceProbe(r)) << 1;
2128 +            else
2129 +                return q;
2130          }
2131      }
2132  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines