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.243 by dl, Wed Jul 22 18:50:10 2015 UTC vs.
Revision 1.244 by jsr166, Wed Jul 22 20:46:50 2015 UTC

# Line 1358 | Line 1358 | public class ForkJoinPool extends Abstra
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();
# Line 1372 | Line 1372 | public class ForkJoinPool extends Abstra
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
# Line 1443 | Line 1443 | public class ForkJoinPool extends Abstra
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) {
# Line 1485 | Line 1485 | public class ForkJoinPool extends Abstra
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;
# Line 1693 | Line 1693 | public class ForkJoinPool extends Abstra
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)) |
# Line 2352 | Line 2352 | public class ForkJoinPool extends Abstra
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) {
# Line 2382 | Line 2382 | public class ForkJoinPool extends Abstra
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)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines