Threads allow multiple processes to execute at the same time. The following is a very simple example of a threaded program:
use std::thread; fn main() { thread::spawn(|| { println!("Hello from a thread in your Rust program"); }); }
Code files can be found in Chapter11/SimpleThreadExample.
When compiled, you may expect the println! to show. However, what you get is this:
Figure 1
Why is the println! not showing?