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

Comparing jsr166/src/jsr166e/StampedLock.java (file contents):
Revision 1.12 by jsr166, Sat Oct 13 23:05:13 2012 UTC vs.
Revision 1.18 by jsr166, Mon Oct 15 05:26:53 2012 UTC

# Line 180 | Line 180 | public class StampedLock implements java
180       * read-locked.  The read count is ignored when validating
181       * "optimistic" seqlock-reader-style stamps.  Because we must use
182       * a small finite number of bits (currently 7) for readers, a
183 <     * supplementary reader overflow word is used when then number of
183 >     * supplementary reader overflow word is used when the number of
184       * readers exceeds the count field. We do this by treating the max
185       * reader count value (RBITS) as a spinlock protecting overflow
186       * updates.
# Line 261 | Line 261 | public class StampedLock implements java
261      private static final int OVERFLOW_YIELD_RATE = 7; // must be power 2 - 1
262  
263      /** The number of bits to use for reader count before overflowing */
264 <    private static final int  LG_READERS = 7;
264 >    private static final int LG_READERS = 7;
265  
266      // Values for lock state and stamp operations
267      private static final long RUNIT = 1L;
# Line 310 | Line 310 | public class StampedLock implements java
310      private transient int readerOverflow;
311  
312      /**
313 <     * Creates a new lock initially in unlocked state.
313 >     * Creates a new lock, initially in unlocked state.
314       */
315      public StampedLock() {
316          state = ORIGIN;
# Line 334 | Line 334 | public class StampedLock implements java
334       * Exclusively acquires the lock if it is immediately available.
335       *
336       * @return a stamp that can be used to unlock or convert mode,
337 <     * or zero if the lock is not available.
337 >     * or zero if the lock is not available
338       */
339      public long tryWriteLock() {
340          long s, next;
# Line 667 | Line 667 | public class StampedLock implements java
667              else if (m == WBIT) {
668                  if (a != m)
669                      break;
670 <                next = state = s + (WBIT + RUNIT);
670 >                state = next = s + (WBIT + RUNIT);
671                  readerPrefSignal();
672                  return next;
673              }
# Line 701 | Line 701 | public class StampedLock implements java
701              else if (m == WBIT) {
702                  if (a != m)
703                      break;
704 <                next = state = (s += WBIT) == 0L ? ORIGIN : s;
704 >                state = next = (s += WBIT) == 0L ? ORIGIN : s;
705                  readerPrefSignal();
706                  return next;
707              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines