1358 |
|
workQueues = new WorkQueue[n]; |
1359 |
|
while (!U.compareAndSwapInt(this, RUNSTATE, rs, rs | STARTED)) |
1360 |
|
rs = runState; |
1361 |
< |
synchronized(sc) { sc.notifyAll(); } |
1361 |
> |
synchronized (sc) { sc.notifyAll(); } |
1362 |
|
break; |
1363 |
|
} |
1364 |
|
else if ((sc = stealCounter) != null) { // wait for initialization |
1365 |
< |
synchronized(sc) { |
1365 |
> |
synchronized (sc) { |
1366 |
|
try { |
1367 |
|
if ((runState & STARTED) == 0) |
1368 |
|
sc.wait(); |
1372 |
|
} |
1373 |
|
} |
1374 |
|
} |
1375 |
< |
if ((rs = runState) < 0) { |
1376 |
< |
tryTerminate(false, false); // help terminate |
1377 |
< |
throw new RejectedExecutionException(); |
1378 |
< |
} |
1375 |
> |
if ((rs = runState) < 0) { |
1376 |
> |
tryTerminate(false, false); // help terminate |
1377 |
> |
throw new RejectedExecutionException(); |
1378 |
> |
} |
1379 |
|
} |
1380 |
|
|
1381 |
|
// Creating, registering and deregistering workers |
1443 |
|
int i = 0; // assign a pool index |
1444 |
|
int mode = config & MODE_MASK; |
1445 |
|
if (lock != null) { |
1446 |
< |
synchronized(lock) { |
1446 |
> |
synchronized (lock) { |
1447 |
|
WorkQueue[] ws = workQueues; |
1448 |
|
int s = indexSeed += SEED_INCREMENT, n, m; |
1449 |
|
if (ws != null && (n = ws.length) > 0) { |
1485 |
|
Object lock; WorkQueue[] ws; // remove index from array |
1486 |
|
int idx = w.config & SMASK; |
1487 |
|
if ((lock = stealCounter) != null) { |
1488 |
< |
synchronized(lock) { |
1488 |
> |
synchronized (lock) { |
1489 |
|
if ((ws = workQueues) != null && ws.length > idx && |
1490 |
|
ws[idx] == w) |
1491 |
|
ws[idx] = null; |
1693 |
|
!Thread.interrupted() && (int)c == ss && |
1694 |
|
(lock = stealCounter) != null && ctl == c && |
1695 |
|
deadline - System.currentTimeMillis() <= TIMEOUT_SLOP_MS) { |
1696 |
< |
synchronized(lock) { // pre-deregister |
1696 |
> |
synchronized (lock) { // pre-deregister |
1697 |
|
WorkQueue[] ws; |
1698 |
|
int cfg = w.config, idx = cfg & SMASK; |
1699 |
|
long nc = ((UC_MASK & (c - TC_UNIT)) | |
2352 |
|
WorkQueue q = new WorkQueue(this, null); |
2353 |
|
q.config = index; |
2354 |
|
q.scanState = ~UNSIGNALLED; |
2355 |
< |
synchronized(lock) { // lock to install |
2355 |
> |
synchronized (lock) { // lock to install |
2356 |
|
WorkQueue[] ws; |
2357 |
|
if ((ws = workQueues) != null && index < ws.length && |
2358 |
|
ws[index] == null) { |
2382 |
|
int rs = runState; |
2383 |
|
WorkQueue[] ws = workQueues; |
2384 |
|
if (rs <= 0 || ws == null || (wl = ws.length) <= 0) |
2385 |
< |
tryInitialize(); |
2385 |
> |
tryInitialize(); |
2386 |
|
else if ((q = ws[k = (wl - 1) & r & SQMASK]) == null) |
2387 |
|
tryCreateExternalQueue(k); |
2388 |
|
else if (U.compareAndSwapInt(q, QLOCK, 0, 1)) { |