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.6 by jsr166, Sat Sep 11 18:56:18 2010 UTC vs.
Revision 1.7 by jsr166, Sat Sep 11 21:10:25 2010 UTC

# Line 313 | Line 313 | public class ConcurrentLinkedDeque<E>
313          checkNotNull(e);
314          final Node<E> newNode = new Node<E>(e);
315  
316 <        retry:
316 >        restartFromHead:
317          for (;;) {
318              for (Node<E> h = head, p = h;;) {
319                  Node<E> q = p.prev;
320                  if (q == null) {
321                      if (p.next == p) // PREV_TERMINATOR
322 <                        continue retry;
322 >                        continue restartFromHead;
323                      // p is first node
324                      newNode.lazySetNext(p); // CAS piggyback
325                      if (p.casPrev(null, newNode)) {
# Line 334 | Line 334 | public class ConcurrentLinkedDeque<E>
334                      }
335                  }
336                  else if (p == q)
337 <                    continue retry;
337 >                    continue restartFromHead;
338                  else
339                      p = q;
340              }
# Line 348 | Line 348 | public class ConcurrentLinkedDeque<E>
348          checkNotNull(e);
349          final Node<E> newNode = new Node<E>(e);
350  
351 <        retry:
351 >        restartFromTail:
352          for (;;) {
353              for (Node<E> t = tail, p = t;;) {
354                  Node<E> q = p.next;
355                  if (q == null) {
356                      if (p.prev == p) // NEXT_TERMINATOR
357 <                        continue retry;
357 >                        continue restartFromTail;
358                      // p is last node
359                      newNode.lazySetPrev(p); // CAS piggyback
360                      if (p.casNext(null, newNode)) {
# Line 369 | Line 369 | public class ConcurrentLinkedDeque<E>
369                      }
370                  }
371                  else if (p == q)
372 <                    continue retry;
372 >                    continue restartFromTail;
373                  else
374                      p = q;
375              }
# Line 665 | Line 665 | public class ConcurrentLinkedDeque<E>
665       * Guarantees that head is set to the returned node.
666       */
667      Node<E> first() {
668 <        retry:
668 >        restartFromHead:
669          for (;;) {
670              for (Node<E> h = head, p = h;;) {
671                  Node<E> q = p.prev;
# Line 676 | Line 676 | public class ConcurrentLinkedDeque<E>
676                          || casHead(h, p))
677                          return p;
678                      else
679 <                        continue retry;
679 >                        continue restartFromHead;
680                  } else if (p == q) {
681 <                    continue retry;
681 >                    continue restartFromHead;
682                  } else {
683                      p = q;
684                  }
# Line 693 | Line 693 | public class ConcurrentLinkedDeque<E>
693       * Guarantees that tail is set to the returned node.
694       */
695      Node<E> last() {
696 <        retry:
696 >        restartFromTail:
697          for (;;) {
698              for (Node<E> t = tail, p = t;;) {
699                  Node<E> q = p.next;
# Line 704 | Line 704 | public class ConcurrentLinkedDeque<E>
704                          || casTail(t, p))
705                          return p;
706                      else
707 <                        continue retry;
707 >                        continue restartFromTail;
708                  } else if (p == q) {
709 <                    continue retry;
709 >                    continue restartFromTail;
710                  } else {
711                      p = q;
712                  }
# Line 1071 | Line 1071 | public class ConcurrentLinkedDeque<E>
1071              return false;
1072  
1073          // Atomically splice the chain as the tail of this collection
1074 <        retry:
1074 >        restartFromTail:
1075          for (;;) {
1076              for (Node<E> t = tail, p = t;;) {
1077                  Node<E> q = p.next;
1078                  if (q == null) {
1079                      if (p.prev == p) // NEXT_TERMINATOR
1080 <                        continue retry;
1080 >                        continue restartFromTail;
1081                      // p is last node
1082                      splice.lazySetPrev(p); // CAS piggyback
1083                      if (p.casNext(null, splice)) {
# Line 1094 | Line 1094 | public class ConcurrentLinkedDeque<E>
1094                      }
1095                  }
1096                  else if (p == q)
1097 <                    continue retry;
1097 >                    continue restartFromTail;
1098                  else
1099                      p = q;
1100              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines