From 30f7aebe2b2c5124bd317167c5890f370b4a592b Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Sun, 19 Oct 2025 06:55:45 +0000 Subject: [PATCH] Fix poison_timeout_nanoseconds test --- library/std/tests/sync/condvar.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/std/tests/sync/condvar.rs b/library/std/tests/sync/condvar.rs index 2a525f9b5e948..715553be5db25 100644 --- a/library/std/tests/sync/condvar.rs +++ b/library/std/tests/sync/condvar.rs @@ -279,17 +279,20 @@ nonpoison_and_poison_unwrap_test!( test_body: { use locks::Mutex; use locks::Condvar; + use std::sync::Barrier; let sent = Mutex::new(false); let cond = Condvar::new(); + let barrier = Barrier::new(2); thread::scope(|s| { s.spawn(|| { + barrier.wait(); thread::sleep(Duration::from_secs(2)); maybe_unwrap(sent.set(true)); cond.notify_all(); }); - + barrier.wait(); let guard = maybe_unwrap(sent.lock()); // If there is internal overflow, this call will return almost // immediately, before the other thread has reached the `notify_all`