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

Comparing jsr166/src/jsr166y/LinkedTransferQueue.java (file contents):
Revision 1.54 by jsr166, Tue Oct 27 23:14:08 2009 UTC vs.
Revision 1.57 by jsr166, Wed Oct 28 09:28:30 2009 UTC

# Line 373 | Line 373 | public class LinkedTransferQueue<E> exte
373          }
374  
375          final boolean casItem(Object cmp, Object val) {
376 <            assert cmp.getClass() != Node.class;
376 >            assert cmp == null || cmp.getClass() != Node.class;
377              return UNSAFE.compareAndSwapObject(this, itemOffset, cmp, val);
378          }
379  
# Line 410 | Line 410 | public class LinkedTransferQueue<E> exte
410           */
411          final boolean isMatched() {
412              Object x = item;
413 <            return x == this || (x != null) != isData;
413 >            return (x == this) || ((x == null) == isData);
414          }
415  
416          /**
# Line 479 | Line 479 | public class LinkedTransferQueue<E> exte
479      private static final int SYNC    = 2; // for transfer, take
480      private static final int TIMEOUT = 3; // for timed poll, tryTransfer
481  
482 +    @SuppressWarnings("unchecked")
483 +    static <E> E cast(Object item) {
484 +        assert item == null || item.getClass() != Node.class;
485 +        return (E) item;
486 +    }
487 +
488      /**
489       * Implements all queuing methods. See above for explanation.
490       *
# Line 683 | Line 689 | public class LinkedTransferQueue<E> exte
689          return null;
690      }
691  
686    @SuppressWarnings("unchecked")
687    static <E> E cast(Object item) {
688        assert item.getClass() != Node.class;
689        return (E) item;
690    }
691
692      /**
693       * Returns the item in the first unmatched node with isData; or
694       * null if none.  Used by peek.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines