Skip to content

Commit

Permalink
Move exit guard from sys::common::exit_guard to sys::exit_guard.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachs18 committed Jul 5, 2024
1 parent 9de76e3 commit a609370
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions library/std/src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ fn lang_start_internal(
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)?;
panic::catch_unwind(|| crate::sys::exit_guard::unique_thread_exit()).map_err(rt_abort)?;
ret_code
}

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions library/std/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/// descriptors.
mod pal;

pub(crate) mod exit_guard;
mod personality;

pub mod backtrace;
Expand Down
1 change: 0 additions & 1 deletion library/std/src/sys/pal/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#![allow(dead_code)]

pub mod alloc;
pub mod exit_guard;
pub mod small_c_string;

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ pub fn home_dir() -> Option<PathBuf> {
}

pub fn exit(code: i32) -> ! {
crate::sys::common::exit_guard::unique_thread_exit();
crate::sys::exit_guard::unique_thread_exit();
unsafe { libc::exit(code as c_int) }
}

Expand Down

0 comments on commit a609370

Please sign in to comment.