diff options
| author | Zachary S <zasample18+github@gmail.com> | 2024-07-03 13:45:37 -0500 |
|---|---|---|
| committer | Zachary S <zasample18+github@gmail.com> | 2024-07-03 13:45:37 -0500 |
| commit | b4149c6ad479cb35006355a1f1a3c0992a9f8b0e (patch) | |
| tree | fac42372baf8dde974468dbb2715a4fbc04c807a /library/std | |
| parent | b512608275fed67cfccd05bea91d48d708ea7ae9 (diff) | |
| download | rust-b4149c6ad479cb35006355a1f1a3c0992a9f8b0e.tar.gz rust-b4149c6ad479cb35006355a1f1a3c0992a9f8b0e.zip | |
Move unique_thread_exit call to lang_start_internal so it is not in a generic function, and wrap it in `catch_unwind`
Diffstat (limited to 'library/std')
| -rw-r--r-- | library/std/src/rt.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/library/std/src/rt.rs b/library/std/src/rt.rs index 376bf344069..8a6f3fe291a 100644 --- a/library/std/src/rt.rs +++ b/library/std/src/rt.rs @@ -144,6 +144,10 @@ fn lang_start_internal( rtabort!("drop of the panic payload panicked"); }); panic::catch_unwind(cleanup).map_err(rt_abort)?; + // Guard against multple threads calling `libc::exit` concurrently. + // See the documentation for `unique_thread_exit` for more information. + panic::catch_unwind(|| crate::sys::common::exit_guard::unique_thread_exit()) + .map_err(rt_abort)?; ret_code } @@ -161,8 +165,5 @@ fn lang_start<T: crate::process::Termination + 'static>( argv, sigpipe, ); - // Guard against multple threads calling `libc::exit` concurrently. - // See the documentation for `unique_thread_exit` for more information. - crate::sys::common::exit_guard::unique_thread_exit(); v } |
