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

Comparing jsr166/src/main/java/util/concurrent/LinkedBlockingQueue.java (file contents):
Revision 1.104 by jsr166, Mon Dec 26 19:54:45 2016 UTC vs.
Revision 1.105 by jsr166, Tue Dec 27 16:15:44 2016 UTC

# Line 478 | Line 478 | public class LinkedBlockingQueue<E> exte
478      }
479  
480      /**
481 <     * Unlinks interior Node p with predecessor trail.
481 >     * Unlinks interior Node p with predecessor pred.
482       */
483 <    void unlink(Node<E> p, Node<E> trail) {
483 >    void unlink(Node<E> p, Node<E> pred) {
484          // assert putLock.isHeldByCurrentThread();
485          // assert takeLock.isHeldByCurrentThread();
486          // p.next is not changed, to allow iterators that are
487          // traversing p to maintain their weak-consistency guarantee.
488          p.item = null;
489 <        trail.next = p.next;
489 >        pred.next = p.next;
490          if (last == p)
491 <            last = trail;
491 >            last = pred;
492          if (count.getAndDecrement() == capacity)
493              notFull.signal();
494      }
# Line 508 | Line 508 | public class LinkedBlockingQueue<E> exte
508          if (o == null) return false;
509          fullyLock();
510          try {
511 <            for (Node<E> trail = head, p = trail.next;
511 >            for (Node<E> pred = head, p = pred.next;
512                   p != null;
513 <                 trail = p, p = p.next) {
513 >                 pred = p, p = p.next) {
514                  if (o.equals(p.item)) {
515 <                    unlink(p, trail);
515 >                    unlink(p, pred);
516                      return true;
517                  }
518              }
# Line 817 | Line 817 | public class LinkedBlockingQueue<E> exte
817              try {
818                  Node<E> node = lastRet;
819                  lastRet = null;
820 <                for (Node<E> trail = head, p = trail.next;
820 >                for (Node<E> pred = head, p = pred.next;
821                       p != null;
822 <                     trail = p, p = p.next) {
822 >                     pred = p, p = p.next) {
823                      if (p == node) {
824 <                        unlink(p, trail);
824 >                        unlink(p, pred);
825                          break;
826                      }
827                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines