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 |
|
} |