Skip to content

Instantly share code, notes, and snippets.

@nectariner
Last active July 8, 2022 21:03
Show Gist options
  • Save nectariner/aac88d0b56e9d00e735a4fa1198abf13 to your computer and use it in GitHub Desktop.
Save nectariner/aac88d0b56e9d00e735a4fa1198abf13 to your computer and use it in GitHub Desktop.
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