Skip to content

Commit

Permalink
SeqCst->Relaxed in condvar test.
Browse files Browse the repository at this point in the history
Relaxed is enough here. Synchronization is done by the mutex.
  • Loading branch information
m-ou-se committed Mar 20, 2024
1 parent acddc55 commit 3462175
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/std/src/sync/condvar/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ fn wait_timeout_wake() {
let t = thread::spawn(move || {
let _g = m2.lock().unwrap();
thread::sleep(Duration::from_millis(1));
notified_copy.store(true, Ordering::SeqCst);
notified_copy.store(true, Ordering::Relaxed);
c2.notify_one();
});
let (g, timeout_res) = c.wait_timeout(g, Duration::from_millis(u64::MAX)).unwrap();
assert!(!timeout_res.timed_out());
// spurious wakeups mean this isn't necessarily true
// so execute test again, if not notified
if !notified.load(Ordering::SeqCst) {
if !notified.load(Ordering::Relaxed) {
t.join().unwrap();
continue;
}
Expand Down

0 comments on commit 3462175

Please sign in to comment.