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.5 by jsr166, Fri Oct 12 16:53:10 2012 UTC vs.
Revision 1.6 by dl, Fri Oct 12 17:35:29 2012 UTC

# Line 26 | Line 26 | import java.util.concurrent.TimeUnit;
26   *   in method {@link #unlockWrite} to release the lock. Untimed and
27   *   timed versions of {@code tryWriteLock} are also provided. When
28   *   the lock is held in write mode, no read locks may be obtained,
29 < *   and all observer validations will fail.  </li>
29 > *   and all optimistic read validations will fail.  </li>
30   *
31   *  <li><b>Reading.</b> Method {@link #readLock} possibly blocks
32   *   waiting for non-exclusive access, returning a stamp that can be
# Line 87 | Line 87 | import java.util.concurrent.TimeUnit;
87   *
88   *  <pre>{@code
89   * class Point {
90 < *   private volatile double x, y;
90 > *   private double x, y;
91   *   private final StampedLock sl = new StampedLock();
92   *
93   *   void move(double deltaX, double deltaY) { // an exclusively locked method
# Line 237 | Line 237 | public class StampedLock implements java
237      /** Maximum number of retries before blocking on acquisition */
238      private static final int SPINS = (NCPU > 1) ? 1 << 6 : 1;
239  
240 <    /** Maximum number of retries before re-blocking on write lock */
240 >    /** Maximum number of retries before re-blocking */
241      private static final int MAX_HEAD_SPINS = (NCPU > 1) ? 1 << 12 : 1;
242  
243      /** The period for yielding when waiting for overflow spinlock */
# Line 1103 | Line 1103 | public class StampedLock implements java
1103      /**
1104       * If node non-null, forces cancel status and unsplices from queue
1105       * if possible, by traversing entire queue looking for cancelled
1106 <     * nodes, cleaning out all at head, but stopping upon first
1107 <     * encounter otherwise.
1106 >     * nodes.
1107       */
1108      private long cancelReader(RNode node, boolean interrupted) {
1109          Thread w;
# Line 1119 | Line 1118 | public class StampedLock implements java
1118                      }
1119                      else {
1120                          U.compareAndSwapObject(pred, RNEXT, p, q);
1121 <                        break;
1121 >                        p = pred.next;
1122                      }
1123                  }
1124                  else {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines