mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2024-11-25 14:20:08 +03:00
Merge pull request #208 from pan93412/ready-to-atomic
refactor(core): 🐛 Use AtomicBool for READY
This commit is contained in:
commit
88b1344937
3 changed files with 5 additions and 7 deletions
|
@ -27,13 +27,13 @@ pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
|
|||
pub const APP_DEBUG: bool = cfg!(debug_assertions);
|
||||
|
||||
/// Sets to `true` when the `App` component is ready (fully initialized)
|
||||
pub static mut READY: bool = false;
|
||||
pub static READY: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
// TODO: get rid of using this function in all the components' events
|
||||
// e.g. by converting preferences pages into Relm4 Components
|
||||
/// Check if the app is ready
|
||||
pub fn is_ready() -> bool {
|
||||
unsafe { READY }
|
||||
READY.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
|
|
|
@ -174,10 +174,10 @@ impl SimpleComponent for FirstRunApp {
|
|||
|
||||
unsafe {
|
||||
MAIN_WINDOW = Some(widgets.window.clone());
|
||||
|
||||
crate::READY = true;
|
||||
}
|
||||
|
||||
crate::READY.store(true, Ordering::Relaxed);
|
||||
|
||||
tracing::info!("First run window initialized. App is ready");
|
||||
|
||||
ComponentParts { model, widgets } // will return soon
|
||||
|
|
|
@ -873,9 +873,7 @@ impl SimpleComponent for App {
|
|||
});
|
||||
|
||||
// Mark app as loaded
|
||||
unsafe {
|
||||
crate::READY = true;
|
||||
}
|
||||
crate::READY.store(true, Ordering::Relaxed);
|
||||
|
||||
tracing::info!("App is ready");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue