Created
November 6, 2019 00:20
-
-
Save rust-play/55a6f21f5ce018ce82756d783517c458 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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