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

Comparing jsr166/src/jsr166y/ForkJoinPool.java (file contents):
Revision 1.176 by jsr166, Tue Jan 22 23:00:06 2013 UTC vs.
Revision 1.186 by jsr166, Mon Sep 16 14:52:48 2013 UTC

# Line 708 | Line 708 | public class ForkJoinPool extends Abstra
708           * shared-queue version is embedded in method externalPush.)
709           *
710           * @param task the task. Caller must ensure non-null.
711 <         * @throw RejectedExecutionException if array cannot be resized
711 >         * @throws RejectedExecutionException if array cannot be resized
712           */
713          final void push(ForkJoinTask<?> task) {
714              ForkJoinTask<?>[] a; ForkJoinPool p;
# Line 907 | Line 907 | public class ForkJoinPool extends Abstra
907           * or any other cancelled task. Returns (true) on any CAS
908           * or consistency check failure so caller can retry.
909           *
910 <         * @return false if no progress can be made, else true;
910 >         * @return false if no progress can be made, else true
911           */
912          final boolean tryRemoveAndExec(ForkJoinTask<?> task) {
913              boolean stat = true, removed = false, empty = true;
# Line 952 | Line 952 | public class ForkJoinPool extends Abstra
952  
953          /**
954           * Polls for and executes the given task or any other task in
955 <         * its CountedCompleter computation
955 >         * its CountedCompleter computation.
956           */
957          final boolean pollAndExecCC(ForkJoinTask<?> root) {
958              ForkJoinTask<?>[] a; int b; Object o;
# Line 1131 | Line 1131 | public class ForkJoinPool extends Abstra
1131       */
1132      private static final int SEED_INCREMENT = 0x61c88647;
1133  
1134 <    /**
1134 >    /*
1135       * Bits and masks for control variables
1136       *
1137       * Field ctl is a long packed with:
# Line 1244 | Line 1244 | public class ForkJoinPool extends Abstra
1244      volatile Object pad10, pad11, pad12, pad13, pad14, pad15, pad16, pad17;
1245      volatile Object pad18, pad19, pad1a, pad1b;
1246  
1247 <    /*
1247 >    /**
1248       * Acquires the plock lock to protect worker array and related
1249       * updates. This method is called only if an initial CAS on plock
1250       * fails. This acts as a spinlock for normal cases, but falls back
# Line 2127 | Line 2127 | public class ForkJoinPool extends Abstra
2127                      w.runSubtask(t);
2128                  }
2129              }
2130 <            else if (active) {       // decrement active count without queuing
2130 >            else if (active) {      // decrement active count without queuing
2131                  long nc = (c = ctl) - AC_UNIT;
2132                  if ((int)(nc >> AC_SHIFT) + (config & SMASK) == 0)
2133 <                    return;          // bypass decrement-then-increment
2133 >                    return;         // bypass decrement-then-increment
2134                  if (U.compareAndSwapLong(this, CTL, c, nc))
2135                      active = false;
2136              }
# Line 2185 | Line 2185 | public class ForkJoinPool extends Abstra
2185       * producing extra tasks amortizes the uncertainty of progress and
2186       * diffusion assumptions.
2187       *
2188 <     * So, users will want to use values larger, but not much larger
2188 >     * So, users will want to use values larger (but not much larger)
2189       * than 1 to both smooth over transient shortages and hedge
2190       * against uneven progress; as traded off against the cost of
2191       * extra task overhead. We leave the user to pick a threshold
# Line 2466 | Line 2466 | public class ForkJoinPool extends Abstra
2466       *         java.lang.RuntimePermission}{@code ("modifyThread")}
2467       */
2468      public ForkJoinPool() {
2469 <        this(Runtime.getRuntime().availableProcessors(),
2469 >        this(Math.min(MAX_CAP, Runtime.getRuntime().availableProcessors()),
2470               defaultForkJoinWorkerThreadFactory, null, false);
2471      }
2472  
# Line 2691 | Line 2691 | public class ForkJoinPool extends Abstra
2691          try {
2692              for (Callable<T> t : tasks) {
2693                  ForkJoinTask<T> f = new ForkJoinTask.AdaptedCallable<T>(t);
2694                externalPush(f);
2694                  futures.add(f);
2695 +                externalPush(f);
2696              }
2697              for (int i = 0, size = futures.size(); i < size; i++)
2698                  ((ForkJoinTask<?>)futures.get(i)).quietlyJoin();
# Line 3166 | Line 3166 | public class ForkJoinPool extends Abstra
3166  
3167      /**
3168       * Waits and/or attempts to assist performing tasks indefinitely
3169 <     * until the {@link #commonPool()} {@link #isQuiescent}
3169 >     * until the {@link #commonPool()} {@link #isQuiescent}.
3170       */
3171      static void quiesceCommonPool() {
3172          common.awaitQuiescence(Long.MAX_VALUE, TimeUnit.NANOSECONDS);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines