[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.92, Sat Jun 13 18:49:24 2015 UTC revision 1.93, Sat Jun 13 22:33:38 2015 UTC
# Line 732  Line 732 
732      }      }
733    
734      /**      /**
735       * Returns the first unmatched node of the given mode, or null if       * Returns the first unmatched data node, or null if none.
736       * none.  Used by hasWaitingConsumer.       * Callers must recheck if the returned node's item field is null
737       */       * or self-linked before using.
     private Node firstOfMode(boolean isData) {  
         for (Node p = head; p != null; p = succ(p)) {  
             if (!p.isMatched())  
                 return (p.isData == isData) ? p : null;  
         }  
         return null;  
     }  
   
     /**  
      * Version of firstOfMode used by Spliterator. Callers must  
      * recheck if the returned node's item field is null or  
      * self-linked before using.  
738       */       */
739      final Node firstDataNode() {      final Node firstDataNode() {
740          restartFromHead: for (;;) {          restartFromHead: for (;;) {
# Line 1428  Line 1416 
1416      }      }
1417    
1418      public boolean hasWaitingConsumer() {      public boolean hasWaitingConsumer() {
1419          return firstOfMode(false) != null;          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      /**      /**

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.93

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8