3 ms·
> Rust made the same call. It did not though? - threads implicitly catch_panic at their boundary, and convert that to a `Result` which you can receive when yo
by masklinn 3y ago
> Rust made the same call.
It did not though?
- threads implicitly catch_panic at their boundary, and convert that to a `Result` which you can receive when you join on the thread: https://doc.rust-lang.org/std/thread/type.Result.html https://doc.rust-lang.org/std/thread/type.Result.html
- in theory an async runtime could shut down on panic, but tokio at least does not, much like `std::thread::spawn` it'll catch_panic and return a JoinError to however is await-ing the joinhandle: https://docs.rs/tokio/latest/tokio/task/struct.JoinError.html https://docs.rs/tokio/latest/tokio/task/struct.JoinError.htm...
If you drop the handles, the error just is not signaled:
- sync: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b20cc7c1af5ca42485e83820b1c1e56f https://play.rust-lang.org/?version=stable&mode=debug&editio...
- async (tokio): https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=25f424fd6ce6f463d28508633741626c https://play.rust-lang.org/?version=stable&mode=debug&editio...
- galangalalgol 3y agoYeah I think I remember that being a controversial decision when it was made for threads? One of the valid reasons for a panic is that you've encountered something that makes you think your adress space is in a bad state. Threads share an address space, so the reasoning was that if they panic, so should the process, but that isn't what happened.