October 2019
Intermediate to advanced
444 pages
10h 37m
English
Follow these steps to see how to move memory between threads:
use std::thread;use std::time::Duration;fn start_no_shared_data_thread() -> thread::JoinHandle<()> { thread::spawn(|| { // since we are not using a parent scope variable in here // no move is required println!("Waiting for three seconds."); thread::sleep(Duration::from_secs(3)); println!("Done") })}
Read now
Unlock full access