1 use parking_lot::RwLock; 2 use std::thread; 3 4 struct Bar(RwLock<()>); 5 6 impl Drop for Bar { drop(&mut self)7 fn drop(&mut self) { 8 let _n = self.0.write(); 9 } 10 } 11 12 thread_local! { 13 static B: Bar = Bar(RwLock::new(())); 14 } 15 16 #[test] main()17fn main() { 18 thread::spawn(|| { 19 B.with(|_| ()); 20 21 let a = RwLock::new(()); 22 let _a = a.read(); 23 }) 24 .join() 25 .unwrap(); 26 } 27