RFR: jsr166 jdk9 integration wave 7
Martin Buchholz
martinrb at google.com
Tue Jun 28 17:01:13 UTC 2016
On Tue, Jun 28, 2016 at 5:55 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> ConcurrentLinkedDeque
> —
>
> linkFirst uses HEAD.compareAndSet, where as linkLast uses
> TAIL.weakCompareAndSetVolatile, can the former use the weak variant too
> since, as commented, failure is OK.
>
Well spotted!
--- src/main/java/util/concurrent/ConcurrentLinkedDeque.java 17 Jun 2016
13:03:45 -0000 1.73
+++ src/main/java/util/concurrent/ConcurrentLinkedDeque.java 28 Jun 2016
16:59:10 -0000
@@ -300,8 +300,8 @@
// Successful CAS is the linearization point
// for e to become an element of this deque,
// and for newNode to become "live".
- if (p != h) // hop two nodes at a time
- HEAD.compareAndSet(this, h, newNode); //
Failure OK.
+ if (p != h) // hop two nodes at a time; failure is
OK
+ HEAD.weakCompareAndSetVolatile(this, h,
newNode);
return;
}
// Lost CAS race to another thread; re-read prev
More information about the core-libs-dev
mailing list