about summary refs log tree commit diff
path: root/library/std/src/sys/pal/unix/os.rs
diff options
context:
space:
mode:
authorZachary S <zasample18+github@gmail.com>2024-06-18 12:43:06 -0500
committerZachary S <zasample18+github@gmail.com>2024-06-20 21:47:42 -0500
commite71d06be1079db18c39b7088414380d94ce5a8f4 (patch)
tree70881f47d590e6416d85dbaa882d887b05ce7e9d /library/std/src/sys/pal/unix/os.rs
parent11380368dc53d0b2fc3a627408818eff1973ce9a (diff)
downloadrust-e71d06be1079db18c39b7088414380d94ce5a8f4.tar.gz
rust-e71d06be1079db18c39b7088414380d94ce5a8f4.zip
On `target_os = "linux"`, ensure that only one Rust thread calls `libc::exit` or returns from `main`.
Diffstat (limited to 'library/std/src/sys/pal/unix/os.rs')
-rw-r--r--library/std/src/sys/pal/unix/os.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs
index 2e71ceceb58..3f598a095c1 100644
--- a/library/std/src/sys/pal/unix/os.rs
+++ b/library/std/src/sys/pal/unix/os.rs
@@ -758,6 +758,7 @@ pub fn home_dir() -> Option<PathBuf> {
 }
 
 pub fn exit(code: i32) -> ! {
+    crate::sys::common::exit_guard::unique_thread_exit();
     unsafe { libc::exit(code as c_int) }
 }