Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::thread;
- fn main() {
- let mut th:thread::JoinHandle<()>;
- for m in 1..10 {
- let t = thread::spawn(move || {
- println!("{}", m);
- });
- if m==1 {
- th = t;
- }
- else {
- let _ = t.join();
- }
- }
- th.join();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement