5 |
|
*/ |
6 |
|
|
7 |
|
package jsr166e; |
8 |
< |
import java.util.concurrent.atomic.AtomicLong; |
8 |
> |
|
9 |
> |
import java.io.IOException; |
10 |
> |
import java.io.ObjectInputStream; |
11 |
> |
import java.io.ObjectOutputStream; |
12 |
|
import java.io.Serializable; |
13 |
+ |
import java.util.concurrent.atomic.AtomicLong; |
14 |
|
|
15 |
|
/** |
16 |
|
* One or more variables that together maintain an initially zero |
62 |
|
Cell[] as; long b, v; int[] hc; Cell a; int n; |
63 |
|
if ((as = cells) != null || !casBase(b = base, b + x)) { |
64 |
|
boolean uncontended = true; |
65 |
< |
if ((hc = threadHashCode.get()) == null || |
65 |
> |
if ((hc = threadHashCode.get()) == null || |
66 |
|
as == null || (n = as.length) < 1 || |
67 |
|
(a = as[(n - 1) & hc[0]]) == null || |
68 |
|
!(uncontended = a.cas(v = a.value, v + x))) |
186 |
|
return (double)sum(); |
187 |
|
} |
188 |
|
|
189 |
< |
private void writeObject(java.io.ObjectOutputStream s) |
186 |
< |
throws java.io.IOException { |
189 |
> |
private void writeObject(ObjectOutputStream s) throws IOException { |
190 |
|
s.defaultWriteObject(); |
191 |
|
s.writeLong(sum()); |
192 |
|
} |
193 |
|
|
194 |
< |
private void readObject(java.io.ObjectInputStream s) |
195 |
< |
throws java.io.IOException, ClassNotFoundException { |
194 |
> |
private void readObject(ObjectInputStream s) |
195 |
> |
throws IOException, ClassNotFoundException { |
196 |
|
s.defaultReadObject(); |
197 |
|
busy = 0; |
198 |
|
cells = null; |