diff options
| author | Ralf Jung <post@ralfj.de> | 2022-09-20 09:54:18 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-09-20 10:14:30 +0200 |
| commit | 42523d923191f69723f44ba3cc8e27b49de7e3cc (patch) | |
| tree | d05cd386fac0d0c55793724bb856436d01eead11 | |
| parent | dfa6f8894e6d56f3c01062f0735f87a70e180fd0 (diff) | |
| download | rust-42523d923191f69723f44ba3cc8e27b49de7e3cc.tar.gz rust-42523d923191f69723f44ba3cc8e27b49de7e3cc.zip | |
make a sync test more reliable
| -rw-r--r-- | tests/pass/concurrency/sync.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/pass/concurrency/sync.rs b/tests/pass/concurrency/sync.rs index 7835d9747de..8bda32bb95a 100644 --- a/tests/pass/concurrency/sync.rs +++ b/tests/pass/concurrency/sync.rs @@ -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(); } |
