use std::thread;
const NTHREADS: u32 = 6;
// Vector to hold the spawned children.
let mut children = vec![];
for i in 0..NTHREADS {
// Spin up another thread
children.push(thread::spawn(move || {
println!("this is thread number {}", i);
}));
}
for child in children {
// Wait for finish to return a result
let _ = child.join();
}