--- jsr166/src/jsr166e/LongAdder.java 2011/07/31 14:20:01 1.1 +++ jsr166/src/jsr166e/LongAdder.java 2011/08/01 06:19:47 1.3 @@ -130,7 +130,7 @@ public class LongAdder implements Serial code = (h == 0) ? 1 : h; } } - + /** * The corresponding ThreadLocal class */ @@ -146,7 +146,7 @@ public class LongAdder implements Serial */ static final ThreadHashCode threadHashCode = new ThreadHashCode(); - /** Nomber of CPUS, to place bound on table size */ + /** Number of CPUS, to place bound on table size */ private static final int NCPU = Runtime.getRuntime().availableProcessors(); /** @@ -156,7 +156,7 @@ public class LongAdder implements Serial /** * Base sum, used mainly when there is no contention, but also as - * a fallback during table initializion races. Updated via CAS. + * a fallback during table initialization races. Updated via CAS. */ private transient volatile long base; @@ -233,7 +233,7 @@ public class LongAdder implements Serial } else if (!wasUncontended) // CAS already known to fail wasUncontended = true; // Continue after rehash - else if (UNSAFE.compareAndSwapLong(a, valueOffset, + else if (UNSAFE.compareAndSwapLong(a, valueOffset, v = a.value, v + x)) break; else if (n >= NCPU || cells != as) @@ -275,7 +275,7 @@ public class LongAdder implements Serial if (init) break; } - else if (UNSAFE.compareAndSwapLong(this, baseOffset, + else if (UNSAFE.compareAndSwapLong(this, baseOffset, v = base, v + x)) break; // Fall back on using base }