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

Comparing jsr166/src/main/java/util/concurrent/FutureTask.java (file contents):
Revision 1.98 by jsr166, Fri Dec 2 15:47:22 2011 UTC vs.
Revision 1.99 by jsr166, Tue Dec 20 01:03:46 2011 UTC

# Line 362 | Line 362 | public class FutureTask<V> implements Ru
362       */
363      private int awaitDone(boolean timed, long nanos)
364          throws InterruptedException {
365 <        long last = timed ? System.nanoTime() : 0L;
365 >        final long deadline = timed ? System.nanoTime() + nanos : 0L;
366          WaitNode q = null;
367          boolean queued = false;
368          for (;;) {
# Line 385 | Line 385 | public class FutureTask<V> implements Ru
385                  queued = UNSAFE.compareAndSwapObject(this, waitersOffset,
386                                                       q.next = waiters, q);
387              else if (timed) {
388 <                long now = System.nanoTime();
389 <                if ((nanos -= (now - last)) <= 0L) {
388 >                nanos = deadline - System.nanoTime();
389 >                if (nanos <= 0L) {
390                      removeWaiter(q);
391                      return state;
392                  }
393                last = now;
393                  LockSupport.parkNanos(this, nanos);
394              }
395              else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines