1 use crate::sync::watch; 2 3 use loom::future::block_on; 4 use loom::thread; 5 6 #[test] smoke()7fn smoke() { 8 loom::model(|| { 9 let (tx, mut rx1) = watch::channel(1); 10 let mut rx2 = rx1.clone(); 11 let mut rx3 = rx1.clone(); 12 let mut rx4 = rx1.clone(); 13 let mut rx5 = rx1.clone(); 14 15 let th = thread::spawn(move || { 16 tx.send(2).unwrap(); 17 }); 18 19 block_on(rx1.changed()).unwrap(); 20 assert_eq!(*rx1.borrow(), 2); 21 22 block_on(rx2.changed()).unwrap(); 23 assert_eq!(*rx2.borrow(), 2); 24 25 block_on(rx3.changed()).unwrap(); 26 assert_eq!(*rx3.borrow(), 2); 27 28 block_on(rx4.changed()).unwrap(); 29 assert_eq!(*rx4.borrow(), 2); 30 31 block_on(rx5.changed()).unwrap(); 32 assert_eq!(*rx5.borrow(), 2); 33 34 th.join().unwrap(); 35 }) 36 } 37