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, |
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 |
|
/** |
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; |
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 |
|
/** |
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 |
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 |
|
/** |
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 |
|
/** |
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 + |