ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/Phaser.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/Phaser.java (file contents):
Revision 1.71 by jsr166, Mon Oct 17 23:34:51 2011 UTC vs.
Revision 1.72 by jsr166, Mon Dec 19 19:58:00 2011 UTC

# Line 1064 | Line 1064 | public class Phaser {
1064          final boolean timed;
1065          boolean wasInterrupted;
1066          long nanos;
1067 <        long lastTime;
1067 >        final long deadline;
1068          volatile Thread thread; // nulled to cancel wait
1069          QNode next;
1070  
# Line 1075 | Line 1075 | public class Phaser {
1075              this.interruptible = interruptible;
1076              this.nanos = nanos;
1077              this.timed = timed;
1078 <            this.lastTime = timed ? System.nanoTime() : 0L;
1078 >            this.deadline = timed ? System.nanoTime() + nanos : 0L;
1079              thread = Thread.currentThread();
1080          }
1081  
# Line 1094 | Line 1094 | public class Phaser {
1094              }
1095              if (timed) {
1096                  if (nanos > 0L) {
1097 <                    long now = System.nanoTime();
1098 <                    nanos -= now - lastTime;
1099 <                    lastTime = now;
1097 >                    nanos = deadline - System.nanoTime();
1098                  }
1099                  if (nanos <= 0L) {
1100                      thread = null;
# Line 1111 | Line 1109 | public class Phaser {
1109                  return true;
1110              else if (!timed)
1111                  LockSupport.park(this);
1112 <            else if (nanos > 0)
1112 >            else if (nanos > 0L)
1113                  LockSupport.parkNanos(this, nanos);
1114              return isReleasable();
1115          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines