Skip to content

Commit 2854f0c

Browse files
committed
Fix flaky condvar test
1 parent 43f2c19 commit 2854f0c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/libstd/sync/condvar.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,15 @@ mod tests {
420420
static M: StaticMutex = MUTEX_INIT;
421421

422422
let g = M.lock().unwrap();
423-
let (g, success) = C.wait_timeout(g, Duration::nanoseconds(1000)).unwrap();
424-
assert!(!success);
423+
let (g, _no_timeout) = C.wait_timeout(g, Duration::nanoseconds(1000)).unwrap();
424+
// spurious wakeups mean this isn't necessarily true
425+
// assert!(!no_timeout);
425426
let _t = Thread::spawn(move || {
426427
let _g = M.lock().unwrap();
427428
C.notify_one();
428429
});
429-
let (g, success) = C.wait_timeout(g, Duration::days(1)).unwrap();
430-
assert!(success);
430+
let (g, no_timeout) = C.wait_timeout(g, Duration::days(1)).unwrap();
431+
assert!(no_timeout);
431432
drop(g);
432433
unsafe { C.destroy(); M.destroy(); }
433434
}

0 commit comments

Comments
 (0)