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