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.19 by dl, Mon Oct 15 12:12:42 2012 UTC vs.
Revision 1.20 by dl, Mon Oct 15 14:02:34 2012 UTC

# Line 125 | Line 125 | import java.util.concurrent.TimeUnit;
125   *   }
126   *
127   *   double distanceFromOriginV2() { // combines code paths
128 + *     double currentX = 0.0, currentY = 0.0;
129   *     for (long stamp = sl.tryOptimisticRead(); ; stamp = sl.readLock()) {
129 *       double currentX = 0.0, currentY = 0.0;
130   *       try {
131   *         currentX = x;
132   *         currentY = y;
133   *       } finally {
134   *         if (sl.tryConvertToOptimisticRead(stamp) != 0L) // unlock or validate
135 < *           return Math.sqrt(currentX * currentX + currentY * currentY);
135 > *           break;
136   *       }
137   *     }
138 + *     return Math.sqrt(currentX * currentX + currentY * currentY);
139   *   }
140   *
141   *   void moveIfAtOrigin(double newX, double newY) { // upgrade
# Line 1007 | Line 1008 | public class StampedLock implements java
1008      /**
1009       * If node non-null, forces cancel status and unsplices from queue
1010       * if possible. This is a variant of cancellation methods in
1011 <     * AbstractQueuedSynchronizer (see its detailed explanation in
1011 >     * AbstractQueuedSynchronizer (see its detailed explanation in AQS
1012       * internal documentation) that more conservatively wakes up other
1013 <     * threads that may have had their links changed so as to preserve
1013 >     * threads that may have had their links changed, so as to preserve
1014       * liveness in the main signalling methods.
1015       */
1016      private long cancelWriter(WNode node, boolean interrupted) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines