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

Comparing jsr166/src/main/java/util/concurrent/LinkedTransferQueue.java (file contents):
Revision 1.92 by jsr166, Sat Jun 13 18:49:24 2015 UTC vs.
Revision 1.93 by jsr166, Sat Jun 13 22:33:38 2015 UTC

# Line 732 | Line 732 | public class LinkedTransferQueue<E> exte
732      }
733  
734      /**
735 <     * Returns the first unmatched node of the given mode, or null if
736 <     * none.  Used by hasWaitingConsumer.
737 <     */
738 <    private Node firstOfMode(boolean isData) {
739 <        for (Node p = head; p != null; p = succ(p)) {
740 <            if (!p.isMatched())
741 <                return (p.isData == isData) ? p : null;
742 <        }
743 <        return null;
744 <    }
745 <
746 <    /**
747 <     * Version of firstOfMode used by Spliterator. Callers must
748 <     * recheck if the returned node's item field is null or
749 <     * self-linked before using.
735 >     * Returns the first unmatched data node, or null if none.
736 >     * Callers must recheck if the returned node's item field is null
737 >     * or self-linked before using.
738       */
739      final Node firstDataNode() {
740          restartFromHead: for (;;) {
# Line 1428 | Line 1416 | public class LinkedTransferQueue<E> exte
1416      }
1417  
1418      public boolean hasWaitingConsumer() {
1419 <        return firstOfMode(false) != null;
1419 >        restartFromHead: for (;;) {
1420 >            for (Node p = head; p != null;) {
1421 >                Object item = p.item;
1422 >                if (p.isData) {
1423 >                    if (item != null && item != p)
1424 >                        break;
1425 >                }
1426 >                else if (item == null)
1427 >                    return true;
1428 >                if (p == (p = p.next))
1429 >                    continue restartFromHead;
1430 >            }
1431 >            return false;
1432 >        }
1433      }
1434  
1435      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines