daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::sync::Arc;
  2. use std::sync::atomic::{AtomicUsize, Ordering};
  3.  
  4. pub fn main() {
  5.  
  6.     let count = 4;
  7.     let v1 = vec![Arc::new(AtomicUsize::new(0)); count];
  8.    
  9.     let mut v2 = vec![];
  10.     for _ in 0..count {
  11.         v2.push(Arc::new(AtomicUsize::new(0)));
  12.     }
  13.    
  14.     v1[0].store(42, Ordering::SeqCst);
  15.     v2[0].store(42, Ordering::SeqCst);
  16.    
  17.     println!("{:?}", v1);
  18.     println!("{:?}", v2);
  19.    
  20. }
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
 
Top