[cvs] / jsr166 / src / main / java / util / concurrent / LinkedTransferQueue.java Repository:
ViewVC logotype

Diff of /jsr166/src/main/java/util/concurrent/LinkedTransferQueue.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.50, Mon Dec 12 20:53:11 2011 UTC revision 1.51, Mon Dec 19 19:58:00 2011 UTC
# Line 666  Line 666 
666       * @return matched item, or e if unmatched on interrupt or timeout       * @return matched item, or e if unmatched on interrupt or timeout
667       */       */
668      private E awaitMatch(Node s, Node pred, E e, boolean timed, long nanos) {      private E awaitMatch(Node s, Node pred, E e, boolean timed, long nanos) {
669          long lastTime = timed ? System.nanoTime() : 0L;          final long deadline = timed ? System.nanoTime() + nanos : 0L;
670          Thread w = Thread.currentThread();          Thread w = Thread.currentThread();
671          int spins = -1; // initialized after first item and cancel checks          int spins = -1; // initialized after first item and cancel checks
672          ThreadLocalRandom randomYields = null; // bound if needed          ThreadLocalRandom randomYields = null; // bound if needed
# Line 697  Line 697 
697                  s.waiter = w;                 // request unpark then recheck                  s.waiter = w;                 // request unpark then recheck
698              }              }
699              else if (timed) {              else if (timed) {
700                  long now = System.nanoTime();                  nanos = deadline - System.nanoTime();
701                  if ((nanos -= now - lastTime) > 0)                  if (nanos > 0L)
702                      LockSupport.parkNanos(this, nanos);                      LockSupport.parkNanos(this, nanos);
                 lastTime = now;  
703              }              }
704              else {              else {
705                  LockSupport.park(this);                  LockSupport.park(this);

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8