You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
neovide/src/running_tracker.rs

32 lines
594 B
Rust

use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
use log::info;
lazy_static! {
pub static ref RUNNING_TRACKER: RunningTracker = RunningTracker::new();
}
pub struct RunningTracker {
running: Arc<AtomicBool>,
}
impl RunningTracker {
fn new() -> Self {
Self {
running: Arc::new(AtomicBool::new(true)),
}
}
pub fn quit(&self, reason: &str) {
self.running.store(false, Ordering::Relaxed);
info!("Quit {}", reason);
}
pub fn is_running(&self) -> bool {
self.running.load(Ordering::Relaxed)
}
}