Skip to content

Commit

Permalink
Auto merge of rust-lang#2553 - RalfJung:macos-is-a-pain, r=RalfJung
Browse files Browse the repository at this point in the history
make a sync test more reliable

CI still failed in https://github.com/rust-lang/miri/actions/runs/3088146532/jobs/4994285794, with a 2 second timeout?!??
  • Loading branch information
bors committed Sep 20, 2022
2 parents dfa6f88 + 42523d9 commit eb84c8b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/pass/concurrency/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,12 @@ fn check_conditional_variables_timed_wait_notimeout() {
let guard = lock.lock().unwrap();

let handle = thread::spawn(move || {
thread::sleep(Duration::from_millis(100)); // Make sure the other thread is waiting by the time we call `notify`.
let (_lock, cvar) = &*pair2;
cvar.notify_one();
});

// macOS runners are very unreliable.
let timeout = if cfg!(target_os = "macos") { 2000 } else { 500 };
let (_guard, timeout) = cvar.wait_timeout(guard, Duration::from_millis(timeout)).unwrap();
let (_guard, timeout) = cvar.wait_timeout(guard, Duration::from_millis(500)).unwrap();
assert!(!timeout.timed_out());
handle.join().unwrap();
}
Expand Down

0 comments on commit eb84c8b

Please sign in to comment.