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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentLinkedDeque.java (file contents):
Revision 1.5 by jsr166, Sat Sep 11 03:53:44 2010 UTC vs.
Revision 1.6 by jsr166, Sat Sep 11 18:56:18 2010 UTC

# Line 94 | Line 94 | public class ConcurrentLinkedDeque<E>
94       *
95       * A new element is added atomically by CASing the null prev or
96       * next reference in the first or last node to a fresh node
97 <     * containing the element.
97 >     * containing the element.  The element's node atomically becomes
98 >     * "live" at that point.
99       *
100       * A node is considered "active" if it is a live node, or the
101       * first or last node.  Active nodes cannot be unlinked.
# Line 322 | Line 323 | public class ConcurrentLinkedDeque<E>
323                      // p is first node
324                      newNode.lazySetNext(p); // CAS piggyback
325                      if (p.casPrev(null, newNode)) {
326 +                        // Successful CAS is the linearization point
327 +                        // for e to become an element of this deque,
328 +                        // and for newNode to become "live".
329                          if (p != h) // hop two nodes at a time
330                              casHead(h, newNode);
331                          return;
# Line 354 | Line 358 | public class ConcurrentLinkedDeque<E>
358                      // p is last node
359                      newNode.lazySetPrev(p); // CAS piggyback
360                      if (p.casNext(null, newNode)) {
361 +                        // Successful CAS is the linearization point
362 +                        // for e to become an element of this deque,
363 +                        // and for newNode to become "live".
364                          if (p != t) // hop two nodes at a time
365                              casTail(t, newNode);
366                          return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines