diff options
| author | kennytm <kennytm@gmail.com> | 2017-11-07 15:52:11 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2017-11-07 22:40:13 +0800 |
| commit | 264bfc418cc6a0d3f2b695f58fc8aaaea7800a4f (patch) | |
| tree | 6ca5663db4876df881c24f996d8ab525166e77e8 /src/libstd | |
| parent | eae36714dff92b1c149bb48d3f6ecb515c9c0470 (diff) | |
| parent | b86bba594023591f4d6c795cf4da115640c3a918 (diff) | |
| download | rust-264bfc418cc6a0d3f2b695f58fc8aaaea7800a4f.tar.gz rust-264bfc418cc6a0d3f2b695f58fc8aaaea7800a4f.zip | |
Rollup merge of #45714 - sdroege:thread-panic-docs, r=dtolnay
Update the std::thread docs and clarify that panics can nowadays be caught
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/thread/mod.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 28a33c7ec14..ee49bf796b8 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -25,11 +25,15 @@ //! //! Fatal logic errors in Rust cause *thread panic*, during which //! a thread will unwind the stack, running destructors and freeing -//! owned resources. Thread panic is unrecoverable from within -//! the panicking thread (i.e. there is no 'try/catch' in Rust), but -//! the panic may optionally be detected from a different thread. If -//! the main thread panics, the application will exit with a non-zero -//! exit code. +//! owned resources. While not meant as a 'try/catch' mechanism, panics +//! in Rust can nonetheless be caught (unless compiling with `panic=abort`) with +//! [`catch_unwind`](../../std/panic/fn.catch_unwind.html) and recovered +//! from, or alternatively be resumed with +//! [`resume_unwind`](../../std/panic/fn.resume_unwind.html). If the panic +//! is not caught the thread will exit, but the panic may optionally be +//! detected from a different thread with [`join`]. If the main thread panics +//! without the panic being caught, the application will exit with a +//! non-zero exit code. //! //! When the main thread of a Rust program terminates, the entire program shuts //! down, even if other threads are still running. However, this module provides |
