28 |
|
* |
29 |
|
* <p> Method {@link #sum} returns the current combined total across |
30 |
|
* the variables maintaining the sum. This value is <em>NOT</em> an |
31 |
< |
* atomic snapshot: Invocation of <code>sum</code> in the absence of |
31 |
> |
* atomic snapshot: Invocation of {@code sum} in the absence of |
32 |
|
* concurrent updates returns an accurate result, but concurrent |
33 |
|
* updates that occur while the sum is being calculated might not be |
34 |
< |
* incorporated. The sum may also be <code>reset</code> to zero, as |
34 |
> |
* incorporated. The sum may also be {@code reset} to zero, as |
35 |
|
* an alternative to creating a new adder. However, method {@link |
36 |
|
* #reset} is intrinsically racy, so should only be used when it is |
37 |
|
* known that no threads are concurrently updating the sum. |
146 |
|
*/ |
147 |
|
static final ThreadHashCode threadHashCode = new ThreadHashCode(); |
148 |
|
|
149 |
< |
/** Nomber of CPUS, to place bound on table size */ |
149 |
> |
/** Number of CPUS, to place bound on table size */ |
150 |
|
private static final int NCPU = Runtime.getRuntime().availableProcessors(); |
151 |
|
|
152 |
|
/** |
156 |
|
|
157 |
|
/** |
158 |
|
* Base sum, used mainly when there is no contention, but also as |
159 |
< |
* a fallback during table initializion races. Updated via CAS. |
159 |
> |
* a fallback during table initialization races. Updated via CAS. |
160 |
|
*/ |
161 |
|
private transient volatile long base; |
162 |
|
|