cdrs
cdrs copied to clipboard
join in multiple thread example
In multiple thread example, join is after every thread spawned. Is this behavior intended?
Or it should be
let mut children = vec![];
for i in 0..20 {
let thread_session = no_compression.clone();
children.push(thread::spawn(move || {
insert_struct(&thread_session, i);
}));
}
for child in children {
let _ = child.join().expect("thread error");
}
I also found this problem, this confuse me a lot. I used to suspect that the drive efficiency was too low.