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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentLinkedQueue.java (file contents):
Revision 1.126 by jsr166, Mon Jun 13 15:31:25 2016 UTC vs.
Revision 1.127 by dl, Fri Jun 17 13:03:45 2016 UTC

# Line 279 | Line 279 | public class ConcurrentLinkedQueue<E> ex
279                      // for e to become an element of this queue,
280                      // and for newNode to become "live".
281                      if (p != t) // hop two nodes at a time
282 <                        TAIL.compareAndSet(this, t, newNode);  // Failure is OK.
282 >                        TAIL.weakCompareAndSetVolatile(this, t, newNode);  // Failure is OK.
283                      return true;
284                  }
285                  // Lost CAS race to another thread; re-read next
# Line 448 | Line 448 | public class ConcurrentLinkedQueue<E> ex
448  
449                  next = succ(p);
450                  if (pred != null && next != null) // unlink
451 <                    NEXT.compareAndSet(pred, p, next);
451 >                    NEXT.weakCompareAndSetVolatile(pred, p, next);
452                  if (removed)
453                      return true;
454              }
# Line 495 | Line 495 | public class ConcurrentLinkedQueue<E> ex
495                  if (NEXT.compareAndSet(p, null, beginningOfTheEnd)) {
496                      // Successful CAS is the linearization point
497                      // for all elements to be added to this queue.
498 <                    if (!TAIL.compareAndSet(this, t, last)) {
498 >                    if (!TAIL.weakCompareAndSetVolatile(this, t, last)) {
499                          // Try a little harder to update tail,
500                          // since we may be adding many elements.
501                          t = tail;
502                          if (last.next == null)
503 <                            TAIL.compareAndSet(this, t, last);
503 >                            TAIL.weakCompareAndSetVolatile(this, t, last);
504                      }
505                      return true;
506                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines