481 |
|
boolean unlinked = false; |
482 |
|
Completion p; |
483 |
|
while ((p = stack) != null && !p.isLive()) // ensure head of stack live |
484 |
< |
unlinked = STACK.compareAndSet(this, p, p.next); |
485 |
< |
if (p != null && !unlinked) { // try to unlink first nonlive |
484 |
> |
unlinked = STACK.weakCompareAndSetVolatile(this, p, p.next); |
485 |
> |
if (p != null && !unlinked) { |
486 |
> |
// try to unlink first nonlive |
487 |
|
for (Completion q = p.next; q != null;) { |
488 |
|
Completion s = q.next; |
489 |
|
if (q.isLive()) { |
490 |
|
p = q; |
491 |
|
q = s; |
492 |
< |
} |
492 |
< |
else { |
493 |
< |
NEXT.compareAndSet(p, q, s); |
492 |
> |
} else if (NEXT.weakCompareAndSetVolatile(p, q, s)) |
493 |
|
break; |
494 |
< |
} |
494 |
> |
else |
495 |
> |
q = p.next; |
496 |
|
} |
497 |
|
} |
498 |
|
} |