ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166y/ForkJoinPool.java
(Generate patch)

Comparing jsr166/src/jsr166y/ForkJoinPool.java (file contents):
Revision 1.101 by dl, Wed Apr 13 11:35:30 2011 UTC vs.
Revision 1.102 by jsr166, Thu Apr 14 01:17:58 2011 UTC

# Line 866 | Line 866 | public class ForkJoinPool extends Abstra
866                  w.parked = false;
867                  if (w.eventCount != v)
868                      break;
869 <                else if (System.nanoTime() - startTime <
869 >                else if (System.nanoTime() - startTime <
870                           SHRINK_RATE - (SHRINK_RATE / 10)) // timing slop
871                      Thread.interrupted();          // spurious wakeup
872                  else if (UNSAFE.compareAndSwapLong(this, ctlOffset,
# Line 996 | Line 996 | public class ForkJoinPool extends Abstra
996          do {} while (!UNSAFE.compareAndSwapLong(this, ctlOffset,  // no mask
997                                                  c = ctl, c + AC_UNIT));
998          int b;
999 <        do {} while(!UNSAFE.compareAndSwapInt(this, blockedCountOffset,
1000 <                                              b = blockedCount, b - 1));
999 >        do {} while (!UNSAFE.compareAndSwapInt(this, blockedCountOffset,
1000 >                                               b = blockedCount, b - 1));
1001      }
1002  
1003      /**
# Line 1149 | Line 1149 | public class ForkJoinPool extends Abstra
1149                          ws[k] = w;
1150                          nextWorkerIndex = k + 1;
1151                          int m = g & SMASK;
1152 <                        g = k > m? ((m << 1) + 1) & SMASK : g + (SG_UNIT<<1);
1152 >                        g = (k > m) ? ((m << 1) + 1) & SMASK : g + (SG_UNIT<<1);
1153                      }
1154                  } finally {
1155                      scanGuard = g;
# Line 1332 | Line 1332 | public class ForkJoinPool extends Abstra
1332       */
1333      final void addQuiescerCount(int delta) {
1334          int c;
1335 <        do {} while(!UNSAFE.compareAndSwapInt(this, quiescerCountOffset,
1336 <                                              c = quiescerCount, c + delta));
1335 >        do {} while (!UNSAFE.compareAndSwapInt(this, quiescerCountOffset,
1336 >                                               c = quiescerCount, c + delta));
1337      }
1338  
1339      /**
# Line 1358 | Line 1358 | public class ForkJoinPool extends Abstra
1358      final int idlePerActive() {
1359          // Approximate at powers of two for small values, saturate past 4
1360          int p = parallelism;
1361 <        int a = p + (int)(ctl >> AC_SHIFT);
1362 <        return (a > (p >>>= 1) ? 0 :
1363 <                a > (p >>>= 1) ? 1 :
1364 <                a > (p >>>= 1) ? 2 :
1365 <                a > (p >>>= 1) ? 4 :
1366 <                8);
1361 >        int a = p + (int)(ctl >> AC_SHIFT);
1362 >        return (a > (p >>>= 1) ? 0 :
1363 >                a > (p >>>= 1) ? 1 :
1364 >                a > (p >>>= 1) ? 2 :
1365 >                a > (p >>>= 1) ? 4 :
1366 >                8);
1367      }
1368  
1369      // Exported methods
# Line 1686 | Line 1686 | public class ForkJoinPool extends Abstra
1686       */
1687      public int getRunningThreadCount() {
1688          int r = parallelism + (int)(ctl >> AC_SHIFT);
1689 <        return r <= 0? 0 : r; // suppress momentarily negative values
1689 >        return (r <= 0) ? 0 : r; // suppress momentarily negative values
1690      }
1691  
1692      /**
# Line 1698 | Line 1698 | public class ForkJoinPool extends Abstra
1698       */
1699      public int getActiveThreadCount() {
1700          int r = parallelism + (int)(ctl >> AC_SHIFT) + blockedCount;
1701 <        return r <= 0? 0 : r; // suppress momentarily negative values
1701 >        return (r <= 0) ? 0 : r; // suppress momentarily negative values
1702      }
1703  
1704      /**
# Line 1853 | Line 1853 | public class ForkJoinPool extends Abstra
1853          int ac = rc + blockedCount;
1854          String level;
1855          if ((c & STOP_BIT) != 0)
1856 <            level = (tc == 0)? "Terminated" : "Terminating";
1856 >            level = (tc == 0) ? "Terminated" : "Terminating";
1857          else
1858 <            level = shutdown? "Shutting down" : "Running";
1858 >            level = shutdown ? "Shutting down" : "Running";
1859          return super.toString() +
1860              "[" + level +
1861              ", parallelism = " + pc +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines