mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-11 05:59:52 +00:00
8261445: Use memory_order_relaxed for os::random().
Reviewed-by: adinn, eosterlund, mdoerr, dholmes
This commit is contained in:
parent
51366439b1
commit
a25bae8239
@ -853,7 +853,7 @@ int os::random() {
|
||||
while (true) {
|
||||
unsigned int seed = _rand_seed;
|
||||
unsigned int rand = next_random(seed);
|
||||
if (Atomic::cmpxchg(&_rand_seed, seed, rand) == seed) {
|
||||
if (Atomic::cmpxchg(&_rand_seed, seed, rand, memory_order_relaxed) == seed) {
|
||||
return static_cast<int>(rand);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user