On target_os = "linux", ensure that only one Rust thread calls libc::exit or returns from main.

This commit is contained in:
Zachary S
2024-06-18 12:43:06 -05:00
parent 11380368dc
commit e71d06be10
4 changed files with 93 additions and 0 deletions

View File

@@ -161,5 +161,8 @@ 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
}