cdrs icon indicating copy to clipboard operation
cdrs copied to clipboard

join in multiple thread example

Open xzdandy opened this issue 5 years ago • 1 comments

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");
}

xzdandy avatar May 13 '19 19:05 xzdandy

I also found this problem, this confuse me a lot. I used to suspect that the drive efficiency was too low.

fanvanzh avatar May 28 '19 09:05 fanvanzh