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.51 by dl, Sat Oct 24 14:33:29 2009 UTC vs.
Revision 1.52 by dl, Sat Oct 24 14:57:32 2009 UTC

# Line 502 | Line 502 | public class LinkedTransferQueue<E> exte
502                      if (isData == haveData)   // can't match
503                          break;
504                      if (p.casItem(item, e)) { // match
505 <                        LockSupport.unpark(p.waiter);
506 <                        while (p != h) {      // update head
507 <                            Node n = p.next;  // by 2 unless singleton
508 <                            if (n != null)
509 <                                p = n;
510 <                            if (head == h && casHead(h, p)) {
505 >                        for (Node q = p; q != h;) {
506 >                            Node n = q.next;  // update head by 2
507 >                            if (n != null)    // unless singleton
508 >                                q = n;
509 >                            if (head == h && casHead(h, q)) {
510                                  h.forgetNext();
511                                  break;
512                              }                 // advance and retry
513                              if ((h = head)   == null ||
514 <                                (p = h.next) == null || !p.isMatched())
514 >                                (q = h.next) == null || !q.isMatched())
515                                  break;        // unless slack < 2
516                          }
517 +                        LockSupport.unpark(p.waiter);
518                          return item;
519                      }
520                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines