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

Comparing jsr166/src/jsr166e/Striped64.java (file contents):
Revision 1.2 by jsr166, Tue Aug 2 18:22:20 2011 UTC vs.
Revision 1.6 by jsr166, Sat Oct 15 17:46:08 2011 UTC

# Line 6 | Line 6
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
12   * for classes supporting dynamic striping on 64bit values. The class
13 < * extends Number so that concrete subclasses can publicly do so.
13 > * extends Number so that concrete subclasses must publicly do so.
14   */
15   abstract class Striped64 extends Number {
16      /*
# Line 79 | Line 77 | abstract class Striped64 extends Number
77       */
78  
79      /**
80 <     * Padded variant of AtomicLong supporting only raw accesses plus
81 <     * CAS The value field is placed between pads, hoping that the JVM
82 <     * doesn't reorder them.
80 >     * Padded variant of AtomicLong supporting only raw accesses plus CAS.
81 >     * The value field is placed between pads, hoping that the JVM doesn't
82 >     * reorder them.
83       *
84       * JVM intrinsics note: It would be possible to use a release-only
85       * form of CAS here, if it were provided.
# Line 140 | Line 138 | abstract class Striped64 extends Number
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      /**
# Line 150 | Line 148 | abstract class Striped64 extends Number
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  
# Line 166 | Line 164 | abstract class Striped64 extends Number
164      }
165  
166      /**
167 <     * CAS the base field
167 >     * CASes the base field.
168       */
169      final boolean casBase(long cmp, long val) {
170          return UNSAFE.compareAndSwapLong(this, baseOffset, cmp, val);
171      }
172  
173      /**
174 <     * CAS the busy field from 0 to 1 to acquire lock.
174 >     * CASes the busy field from 0 to 1 to acquire lock.
175       */
176      final boolean casBusy() {
177          return UNSAFE.compareAndSwapInt(this, busyOffset, 0, 1);
# Line 279 | Line 277 | abstract class Striped64 extends Number
277  
278  
279      /**
280 <     * Set base and all cells to the given value
280 >     * Sets base and all cells to the given value.
281       */
282      final void internalReset(long initialValue) {
283          Cell[] as = cells;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines