SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top