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