8014233: java.lang.Thread should have @Contended on TLR fields
Add the @Contended over three TLR fields. Reviewed-by: psandoz, chegar, dholmes, dl
This commit is contained in:
parent
b158c095ac
commit
32b2aa9183
@ -1993,12 +1993,21 @@ class Thread implements Runnable {
|
|||||||
|
|
||||||
|
|
||||||
// The following three initially uninitialized fields are exclusively
|
// The following three initially uninitialized fields are exclusively
|
||||||
// managed by class java.util.concurrent.ThreadLocalRandom.
|
// managed by class java.util.concurrent.ThreadLocalRandom. These
|
||||||
|
// fields are used to build the high-performance PRNGs in the
|
||||||
|
// concurrent code, and we can not risk accidental false sharing.
|
||||||
|
// Hence, the fields are isolated with @Contended.
|
||||||
|
|
||||||
/** The current seed for a ThreadLocalRandom */
|
/** The current seed for a ThreadLocalRandom */
|
||||||
|
@sun.misc.Contended("tlr")
|
||||||
long threadLocalRandomSeed;
|
long threadLocalRandomSeed;
|
||||||
|
|
||||||
/** Probe hash value; nonzero if threadLocalRandomSeed initialized */
|
/** Probe hash value; nonzero if threadLocalRandomSeed initialized */
|
||||||
|
@sun.misc.Contended("tlr")
|
||||||
int threadLocalRandomProbe;
|
int threadLocalRandomProbe;
|
||||||
|
|
||||||
/** Secondary seed isolated from public ThreadLocalRandom sequence */
|
/** Secondary seed isolated from public ThreadLocalRandom sequence */
|
||||||
|
@sun.misc.Contended("tlr")
|
||||||
int threadLocalRandomSecondarySeed;
|
int threadLocalRandomSecondarySeed;
|
||||||
|
|
||||||
/* Some private helper methods */
|
/* Some private helper methods */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user