Skip to content

Instantly share code, notes, and snippets.

@cgcardona
Forked from rust-play/playground.rs
Created November 6, 2019 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgcardona/ae2b8fc73888ea7cdd34866f533cb168 to your computer and use it in GitHub Desktop.
Save cgcardona/ae2b8fc73888ea7cdd34866f533cb168 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
use std::sync::Arc;
use std::thread;
fn main() {
let five: Arc<i32> = Arc::new(5);
for _ in 0..10 {
let five: Arc<i32> = Arc::clone(&five);
thread::spawn(move || {
println!("{:#?}", five);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment