Last active
July 8, 2022 21:03
-
-
Save nectariner/aac88d0b56e9d00e735a4fa1198abf13 to your computer and use it in GitHub Desktop.
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::thread; | |
use std::time::Duration; | |
let handles: Vec<_> = (0..100) | |
.map(|num| { | |
thread::spawn(move || { | |
thread::sleep(Duration::from_secs(1)); | |
println!("value of {}", num); | |
}) | |
}) | |
.collect(); | |
for handle in handles { | |
handle.join().unwrap(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment