Move all cleanup to sys::cleanup
This commit is contained in:
parent
5b30662741
commit
cf470197ad
@ -102,7 +102,9 @@ pub unsafe fn init() {
|
||||
}
|
||||
|
||||
// SAFETY: must be called only once during runtime cleanup.
|
||||
pub unsafe fn cleanup() {}
|
||||
pub unsafe fn cleanup() {
|
||||
args::cleanup();
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[no_mangle]
|
||||
|
@ -1,5 +1,2 @@
|
||||
#[inline]
|
||||
pub unsafe fn init() {}
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn cleanup() {}
|
||||
|
@ -22,8 +22,6 @@ pub unsafe fn init(argc: isize, argv: *const *const u8) {
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn cleanup() {}
|
||||
|
||||
pub fn args() -> Args {
|
||||
let args = unsafe { (ARGS.load(Ordering::Relaxed) as *const ArgsStore).as_ref() };
|
||||
if let Some(args) = args { Args(args.iter()) } else { Args([].iter()) }
|
||||
|
@ -1,4 +1,2 @@
|
||||
#[cfg_attr(test, allow(dead_code))]
|
||||
pub unsafe fn init() {}
|
||||
|
||||
pub unsafe fn cleanup() {}
|
||||
|
@ -126,7 +126,10 @@ pub unsafe fn init() {
|
||||
}
|
||||
|
||||
// SAFETY: must be called only once during runtime cleanup.
|
||||
pub unsafe fn cleanup() {}
|
||||
pub unsafe fn cleanup() {
|
||||
args::cleanup();
|
||||
stack_overflow::cleanup();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub use crate::sys::android::signal;
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::ffi::OsString;
|
||||
|
||||
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {}
|
||||
pub unsafe fn cleanup() {}
|
||||
|
||||
pub struct Args {}
|
||||
|
||||
|
@ -1,3 +1 @@
|
||||
pub unsafe fn init() {}
|
||||
|
||||
pub unsafe fn cleanup() {}
|
||||
|
@ -7,8 +7,6 @@ use crate::vec;
|
||||
|
||||
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {}
|
||||
|
||||
pub unsafe fn cleanup() {}
|
||||
|
||||
pub struct Args {
|
||||
iter: vec::IntoIter<OsString>,
|
||||
_dont_send_or_sync_me: PhantomData<*mut ()>,
|
||||
|
@ -6,8 +6,6 @@ pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
|
||||
// On wasm these should always be null, so there's nothing for us to do here
|
||||
}
|
||||
|
||||
pub unsafe fn cleanup() {}
|
||||
|
||||
pub fn args() -> Args {
|
||||
Args { iter: Vec::new().into_iter(), _dont_send_or_sync_me: PhantomData }
|
||||
}
|
||||
|
@ -16,8 +16,6 @@ use core::iter;
|
||||
|
||||
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {}
|
||||
|
||||
pub unsafe fn cleanup() {}
|
||||
|
||||
pub fn args() -> Args {
|
||||
unsafe {
|
||||
let lp_cmd_line = c::GetCommandLineW();
|
||||
|
@ -37,5 +37,3 @@ pub unsafe fn init() {
|
||||
// Set the thread stack guarantee for the main thread.
|
||||
let _h = Handler::new();
|
||||
}
|
||||
|
||||
pub unsafe fn cleanup() {}
|
||||
|
@ -9,5 +9,3 @@ impl Handler {
|
||||
}
|
||||
|
||||
pub unsafe fn init() {}
|
||||
|
||||
pub unsafe fn cleanup() {}
|
||||
|
@ -36,8 +36,6 @@ pub fn cleanup() {
|
||||
CLEANUP.call_once(|| unsafe {
|
||||
// SAFETY: Only called once during runtime cleanup.
|
||||
sys::cleanup();
|
||||
sys::args::cleanup();
|
||||
sys::stack_overflow::cleanup();
|
||||
// Flush stdout and disable buffering.
|
||||
crate::io::cleanup();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user