Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use arc_swap::ArcSwap;
- use std::sync::Arc;
- use std::thread;
- fn test(a_s: ArcSwap<u32>) {
- thread::spawn(move || {
- a_s.swap(Arc::new(11));
- });
- }
- fn main() {
- let a_s = ArcSwap::from(Arc::new(22));
- test(a_s.clone());
- println!("{}", a_s.load());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement