-
-
Save cgcardona/ae2b8fc73888ea7cdd34866f533cb168 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains hidden or 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