279 |
|
// for e to become an element of this queue, |
280 |
|
// and for newNode to become "live". |
281 |
|
if (p != t) // hop two nodes at a time |
282 |
< |
TAIL.compareAndSet(this, t, newNode); // Failure is OK. |
282 |
> |
TAIL.weakCompareAndSetVolatile(this, t, newNode); // Failure is OK. |
283 |
|
return true; |
284 |
|
} |
285 |
|
// Lost CAS race to another thread; re-read next |
448 |
|
|
449 |
|
next = succ(p); |
450 |
|
if (pred != null && next != null) // unlink |
451 |
< |
NEXT.compareAndSet(pred, p, next); |
451 |
> |
NEXT.weakCompareAndSetVolatile(pred, p, next); |
452 |
|
if (removed) |
453 |
|
return true; |
454 |
|
} |
495 |
|
if (NEXT.compareAndSet(p, null, beginningOfTheEnd)) { |
496 |
|
// Successful CAS is the linearization point |
497 |
|
// for all elements to be added to this queue. |
498 |
< |
if (!TAIL.compareAndSet(this, t, last)) { |
498 |
> |
if (!TAIL.weakCompareAndSetVolatile(this, t, last)) { |
499 |
|
// Try a little harder to update tail, |
500 |
|
// since we may be adding many elements. |
501 |
|
t = tail; |
502 |
|
if (last.next == null) |
503 |
< |
TAIL.compareAndSet(this, t, last); |
503 |
> |
TAIL.weakCompareAndSetVolatile(this, t, last); |
504 |
|
} |
505 |
|
return true; |
506 |
|
} |