Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. use arc_swap::ArcSwap;
  2. use std::sync::Arc;
  3. use std::thread;
  4.  
  5. fn test(a_s: ArcSwap<u32>) {
  6. thread::spawn(move || {
  7. a_s.swap(Arc::new(11));
  8. });
  9. }
  10.  
  11. fn main() {
  12. let a_s = ArcSwap::from(Arc::new(22));
  13. test(a_s.clone());
  14. println!("{}", a_s.load());
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement