Re:Fourteen Years of Go
by dinosaurdynasty on Saturday November 11, 2023 @11:34AM
(#38231741)
Yeah I've been hit by this, I've setup a panic handler to purposefully kill the entire process because otherwise long-running threads die and don't restart (and it was easier to do it that way).
Completely different. In Rust when you spawn a thread [1] or an async task [2], you'll get a handle from which you can check if a panic happens inside the thread/task. Even if you ignore the handle, a panic inside a thread/task won't crash the entire program.
---
[1] https://doc.rust-lang.org/std/thread/fn.spawn.html
[2] https://docs.rs/tokio/latest/tokio/task/fn.spawn.html