329 |
|
if (p != h) // hop two nodes at a time |
330 |
|
casHead(h, newNode); // Failure is OK. |
331 |
|
return; |
332 |
– |
} else { |
333 |
– |
p = p.prev; // lost CAS race to another thread |
332 |
|
} |
333 |
+ |
// Lost CAS race to another thread; re-read prev |
334 |
|
} |
335 |
|
else if (p == q) |
336 |
|
continue restartFromHead; |
363 |
|
if (p != t) // hop two nodes at a time |
364 |
|
casTail(t, newNode); // Failure is OK. |
365 |
|
return; |
367 |
– |
} else { |
368 |
– |
p = p.next; // lost CAS race to another thread |
366 |
|
} |
367 |
+ |
// Lost CAS race to another thread; re-read next |
368 |
|
} |
369 |
|
else if (p == q) |
370 |
|
continue restartFromTail; |
1107 |
|
casTail(t, last); |
1108 |
|
} |
1109 |
|
return true; |
1112 |
– |
} else { |
1113 |
– |
p = p.next; // lost CAS race to another thread |
1110 |
|
} |
1111 |
+ |
// Lost CAS race to another thread; re-read next |
1112 |
|
} |
1113 |
|
else if (p == q) |
1114 |
|
continue restartFromTail; |