mirror of
https://github.com/PacktPublishing/Rust-High-Performance.git
synced 2026-01-25 02:34:19 +09:00
19 lines
437 B
Rust
19 lines
437 B
Rust
use std::thread;
|
|
|
|
fn main() {
|
|
println!("Before the thread!");
|
|
|
|
let handle = thread::Builder::new()
|
|
.name("bad thread".to_owned())
|
|
.spawn(|| {
|
|
panic!("Panicking inside the thread!");
|
|
})
|
|
.expect("could not create the thread");
|
|
println!("After thread spawn!");
|
|
|
|
if handle.join().is_err() {
|
|
println!("Something bad happened :(");
|
|
}
|
|
println!("After everything!");
|
|
}
|