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; |
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); |