6 |
|
|
7 |
|
package jsr166e; |
8 |
|
import java.util.Random; |
9 |
– |
import java.util.concurrent.atomic.AtomicInteger; |
10 |
– |
import java.util.concurrent.atomic.AtomicLong; |
9 |
|
|
10 |
|
/** |
11 |
|
* A package-local class holding common representation and mechanics |
107 |
|
throw new Error(e); |
108 |
|
} |
109 |
|
} |
110 |
< |
|
110 |
> |
|
111 |
|
} |
112 |
|
|
113 |
|
/** |
122 |
|
code = (h == 0) ? 1 : h; |
123 |
|
} |
124 |
|
} |
125 |
< |
|
125 |
> |
|
126 |
|
/** |
127 |
|
* The corresponding ThreadLocal class |
128 |
|
*/ |
138 |
|
*/ |
139 |
|
static final ThreadHashCode threadHashCode = new ThreadHashCode(); |
140 |
|
|
141 |
< |
/** Nomber of CPUS, to place bound on table size */ |
141 |
> |
/** Number of CPUS, to place bound on table size */ |
142 |
|
static final int NCPU = Runtime.getRuntime().availableProcessors(); |
143 |
|
|
144 |
|
/** |
148 |
|
|
149 |
|
/** |
150 |
|
* Base value, used mainly when there is no contention, but also as |
151 |
< |
* a fallback during table initializion races. Updated via CAS. |
151 |
> |
* a fallback during table initialization races. Updated via CAS. |
152 |
|
*/ |
153 |
|
transient volatile long base; |
154 |
|
|
236 |
|
collide = false; // At max size or stale |
237 |
|
else if (!collide) |
238 |
|
collide = true; |
239 |
< |
else if (busy == 0 && casBusy()) { |
239 |
> |
else if (busy == 0 && casBusy()) { |
240 |
|
try { |
241 |
|
if (cells == as) { // Expand table unless stale |
242 |
|
Cell[] rs = new Cell[n << 1]; |
291 |
|
} |
292 |
|
} |
293 |
|
} |
294 |
< |
|
294 |
> |
|
295 |
|
// Unsafe mechanics |
296 |
|
private static final sun.misc.Unsafe UNSAFE; |
297 |
|
private static final long baseOffset; |
337 |
|
} |
338 |
|
} |
339 |
|
|
340 |
< |
} |
340 |
> |
} |