Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8261445: Use memory_order_relaxed for os::random().
Reviewed-by: phh
Backport-of: a25bae8
  • Loading branch information
Victor Rudometov authored and Paul Hohensee committed Nov 7, 2022
1 parent 8f5ae91 commit df9c46a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/os.cpp
Expand Up @@ -864,7 +864,7 @@ int os::random() {
while (true) {
unsigned int seed = _rand_seed;
unsigned int rand = random_helper(seed);
if (Atomic::cmpxchg(rand, &_rand_seed, seed) == seed) {
if (Atomic::cmpxchg(rand, &_rand_seed, seed, memory_order_relaxed) == seed) {
return static_cast<int>(rand);
}
}
Expand Down

1 comment on commit df9c46a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.