@@ -144,6 +144,10 @@ fn lang_start_internal(
|
144 | 144 | rtabort!("drop of the panic payload panicked"); |
145 | 145 | }); |
146 | 146 | panic::catch_unwind(cleanup).map_err(rt_abort)?; |
| 147 | +// Guard against multple threads calling `libc::exit` concurrently. |
| 148 | +// See the documentation for `unique_thread_exit` for more information. |
| 149 | + panic::catch_unwind(|| crate::sys::common::exit_guard::unique_thread_exit()) |
| 150 | +.map_err(rt_abort)?; |
147 | 151 | ret_code |
148 | 152 | } |
149 | 153 | |
@@ -161,8 +165,5 @@ fn lang_start<T: crate::process::Termination + 'static>(
|
161 | 165 | argv, |
162 | 166 | sigpipe, |
163 | 167 | ); |
164 | | -// Guard against multple threads calling `libc::exit` concurrently. |
165 | | -// See the documentation for `unique_thread_exit` for more information. |
166 | | -crate::sys::common::exit_guard::unique_thread_exit(); |
167 | 168 | v |
168 | 169 | } |