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.205 by dl, Tue Jul 8 14:17:09 2014 UTC vs.
Revision 1.206 by dl, Tue Jul 8 17:58:12 2014 UTC

# Line 1520 | Line 1520 | public class ForkJoinPool extends Abstra
1520          }
1521          if (!tryTerminate(false, false) && w != null && w.array != null) {
1522              WorkQueue[] ws; int m, sp;
1523 <            while ((ws = workQueues) != null && (m = ws.length - 1) >= 0) {
1523 >            while ((runState & STOP) == 0 &&
1524 >                   (ws = workQueues) != null && (m = ws.length - 1) >= 0) {
1525                  if ((sp = (int)(c = ctl)) != 0) {     // wake up replacement
1526                      if (tryRelease(c, ws[sp & m], AC_UNIT))
1527                          break;
# Line 2154 | Line 2155 | public class ForkJoinPool extends Abstra
2155              unlockRunState(rs, (rs & ~RSLOCK) | SHUTDOWN);
2156          }
2157          if ((rs & STOP) == 0) {
2158 <            if (!now && (int)(ctl >> AC_SHIFT) + (config & SMASK) > 0)
2159 <                return false;
2160 <            WorkQueue[] ws; WorkQueue w;          // check external submissions
2161 <            if ((ws = workQueues) != null) {
2162 <                for (int i = 0; i < ws.length; ++i) {
2163 <                    if ((w = ws[i]) != null &&
2164 <                        (w.base != w.top ||
2165 <                         ((i & 1) != 0 && w.scanState >= 0))) {
2166 <                        signalWork(ws, w);
2167 <                        return false;
2158 >            if (!now) {
2159 >                if ((int)(ctl >> AC_SHIFT) + (config & SMASK) > 0)
2160 >                    return false;
2161 >                WorkQueue[] ws; WorkQueue w;      // check external submissions
2162 >                if ((ws = workQueues) != null) {
2163 >                    for (int i = 0; i < ws.length; ++i) {
2164 >                        if ((w = ws[i]) != null && !w.isEmpty()) {
2165 >                            signalWork(ws, w);
2166 >                            return false;
2167 >                        }
2168                      }
2169                  }
2170 +                if ((int)(ctl >> AC_SHIFT) + (config & SMASK) > 0)
2171 +                    return false;                 // recheck
2172              }
2173              rs = lockRunState();                  // enter STOP phase
2174              unlockRunState(rs, (rs & ~RSLOCK) | STOP);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines