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.163 by dl, Mon Dec 17 16:32:54 2012 UTC vs.
Revision 1.164 by dl, Tue Dec 18 21:46:16 2012 UTC

# Line 1460 | Line 1460 | public class ForkJoinPool extends Abstra
1460                  if (e > 0) {             // activate or create replacement
1461                      if ((ws = workQueues) == null ||
1462                          (i = e & SMASK) >= ws.length ||
1463 <                        (v = ws[i]) != null)
1463 >                        (v = ws[i]) == null)
1464                          break;
1465                      long nc = (((long)(v.nextWait & E_MASK)) |
1466                                 ((long)(u + UAC_UNIT) << 32));
# Line 2103 | Line 2103 | public class ForkJoinPool extends Abstra
2103       */
2104      private WorkQueue findNonEmptyStealQueue(int r) {
2105          for (WorkQueue[] ws;;) {
2106 <            int ps = plock, m, n;
2106 >            int ps = plock, m;
2107              if ((ws = workQueues) == null || (m = ws.length - 1) < 1)
2108                  return null;
2109              for (int j = (m + 1) << 2; ;) {
2110                  WorkQueue q = ws[(((r + j) << 1) | 1) & m];
2111 <                if (q != null && (n = q.base - q.top) < 0) {
2112 <                    if (n < -1)
2113 <                        signalWork(q);
2111 >                if (q != null && q.base - q.top < 0)
2112                      return q;
2115                }
2113                  else if (--j < 0) {
2114                      if (plock == ps)
2115                          return null;
# Line 2143 | Line 2140 | public class ForkJoinPool extends Abstra
2140                      do {} while (!U.compareAndSwapLong
2141                                   (this, CTL, c = ctl, c + AC_UNIT));
2142                  }
2143 <                if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null)
2143 >                if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null) {
2144 >                    if (q.base - q.top < 0)
2145 >                        signalWork(q);
2146                      w.runSubtask(t);
2147 +                }
2148              }
2149              else {
2150                  long c;
# Line 2176 | Line 2176 | public class ForkJoinPool extends Abstra
2176                  return t;
2177              if ((q = findNonEmptyStealQueue(w.nextSeed())) == null)
2178                  return null;
2179 <            if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null)
2179 >            if ((b = q.base) - q.top < 0 && (t = q.pollAt(b)) != null) {
2180 >                if (q.base - q.top < 0)
2181 >                    signalWork(q);
2182                  return t;
2183 +            }
2184          }
2185      }
2186  
# Line 2475 | Line 2478 | public class ForkJoinPool extends Abstra
2478          if ((p = commonPool) != null &&
2479              (q = p.findNonEmptyStealQueue(1)) != null &&
2480              (b = q.base) - q.top < 0 &&
2481 <            (t = q.pollAt(b)) != null)
2481 >            (t = q.pollAt(b)) != null) {
2482 >            if (q.base - q.top < 0)
2483 >                p.signalWork(q);
2484              t.doExec();
2485 +        }
2486      }
2487  
2488      // Exported methods

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines