ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/LongAdder.java
(Generate patch)

Comparing jsr166/src/jsr166e/LongAdder.java (file contents):
Revision 1.1 by dl, Sun Jul 31 14:20:01 2011 UTC vs.
Revision 1.3 by jsr166, Mon Aug 1 06:19:47 2011 UTC

# Line 130 | Line 130 | public class LongAdder implements Serial
130              code = (h == 0) ? 1 : h;
131          }
132      }
133 <    
133 >
134      /**
135       * The corresponding ThreadLocal class
136       */
# Line 146 | Line 146 | public class LongAdder implements Serial
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      /**
# Line 156 | Line 156 | public class LongAdder implements Serial
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  
# Line 233 | Line 233 | public class LongAdder implements Serial
233                  }
234                  else if (!wasUncontended)       // CAS already known to fail
235                      wasUncontended = true;      // Continue after rehash
236 <                else if (UNSAFE.compareAndSwapLong(a, valueOffset,
236 >                else if (UNSAFE.compareAndSwapLong(a, valueOffset,
237                                                     v = a.value, v + x))
238                      break;
239                  else if (n >= NCPU || cells != as)
# Line 275 | Line 275 | public class LongAdder implements Serial
275                  if (init)
276                      break;
277              }
278 <            else if (UNSAFE.compareAndSwapLong(this, baseOffset,
278 >            else if (UNSAFE.compareAndSwapLong(this, baseOffset,
279                                                 v = base, v + x))
280                  break;                          // Fall back on using base
281          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines