We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c66d02e commit 7bea58eCopy full SHA for 7bea58e
src/liballoc/sync/tests.rs
@@ -340,7 +340,9 @@ fn test_weak_count_locked() {
340
let mut a = Arc::new(atomic::AtomicBool::new(false));
341
let a2 = a.clone();
342
let t = thread::spawn(move || {
343
- for _i in 0..1000000 {
+ // Miri is too slow
344
+ let count = if cfg!(miri) { 1000 } else { 1000000 };
345
+ for _i in 0..count {
346
Arc::get_mut(&mut a);
347
}
348
a.store(true, SeqCst);
@@ -349,6 +351,8 @@ fn test_weak_count_locked() {
349
351
while !a2.load(SeqCst) {
350
352
let n = Arc::weak_count(&a2);
353
assert!(n < 2, "bad weak count: {}", n);
354
+ #[cfg(miri)] // Miri's scheduler does not guarantee liveness, and thus needs this hint.
355
+ atomic::spin_loop_hint();
356
357
t.join().unwrap();
358
0 commit comments