680 |
@SuppressWarnings("unchecked") E itemE = (E) item; |
@SuppressWarnings("unchecked") E itemE = (E) item; |
681 |
return itemE; |
return itemE; |
682 |
} |
} |
683 |
if ((w.isInterrupted() || (timed && nanos <= 0)) && |
else if (w.isInterrupted() || (timed && nanos <= 0)) { |
684 |
s.casItem(e, s)) { // cancel |
unsplice(pred, s); // try to unlink and cancel |
685 |
unsplice(pred, s); |
if (s.casItem(e, s)) // return normally if lost CAS |
686 |
return e; |
return e; |
687 |
} |
} |
688 |
|
else if (spins < 0) { // establish spins at/near front |
|
if (spins < 0) { // establish spins at/near front |
|
689 |
if ((spins = spinsFor(pred, s.isData)) > 0) |
if ((spins = spinsFor(pred, s.isData)) > 0) |
690 |
randomYields = ThreadLocalRandom.current(); |
randomYields = ThreadLocalRandom.current(); |
691 |
} |
} |
1022 |
* @param s the node to be unspliced |
* @param s the node to be unspliced |
1023 |
*/ |
*/ |
1024 |
final void unsplice(Node pred, Node s) { |
final void unsplice(Node pred, Node s) { |
1025 |
s.forgetContents(); // forget unneeded fields |
s.waiter = null; // disable signals |
1026 |
/* |
/* |
1027 |
* See above for rationale. Briefly: if pred still points to |
* See above for rationale. Briefly: if pred still points to |
1028 |
* s, try to unlink s. If s cannot be unlinked, because it is |
* s, try to unlink s. If s cannot be unlinked, because it is |