We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 49edaf1 commit 8416713Copy full SHA for 8416713
src/liballoc/arc.rs
@@ -1501,6 +1501,25 @@ mod tests {
1501
assert!(Arc::ptr_eq(&five, &same_five));
1502
assert!(!Arc::ptr_eq(&five, &other_five));
1503
}
1504
+
1505
+ #[test]
1506
+ #[cfg_attr(target_os = "emscripten", ignore)]
1507
+ fn test_weak_count_locked() {
1508
+ let mut a = Arc::new(atomic::AtomicBool::new(false));
1509
+ let a2 = a.clone();
1510
+ let t = thread::spawn(move || {
1511
+ for _i in 0..1000000 {
1512
+ Arc::get_mut(&mut a);
1513
+ }
1514
+ a.store(true, SeqCst);
1515
+ });
1516
1517
+ while !a2.load(SeqCst) {
1518
+ let n = Arc::weak_count(&a2);
1519
+ assert!(n < 2, "bad weak count: {}", n);
1520
1521
+ t.join().unwrap();
1522
1523
1524
1525
#[stable(feature = "rust1", since = "1.0.0")]
0 commit comments