* chore: update to stable toolchain. apply clippy fixes & rustfmt * Bump MSRV * Try MSRV without the patch version * fix: pin toolchain to MSRV * trying again * fix dead code warning --------- Co-authored-by: Dan Sully <dsully@users.noreply.github.com>
20 lines
568 B
Rust
20 lines
568 B
Rust
use std::sync::atomic::{AtomicBool, Ordering};
|
|
|
|
/// A global variable telling whether the application has been interrupted.
|
|
static INTERRUPTED: AtomicBool = AtomicBool::new(false);
|
|
|
|
/// Tells whether the program has been interrupted
|
|
pub fn interrupted() -> bool {
|
|
INTERRUPTED.load(Ordering::SeqCst)
|
|
}
|
|
|
|
/// Clears the interrupted flag
|
|
pub fn unset_interrupted() {
|
|
debug_assert!(INTERRUPTED.load(Ordering::SeqCst));
|
|
INTERRUPTED.store(false, Ordering::SeqCst);
|
|
}
|
|
|
|
pub fn set_interrupted() {
|
|
INTERRUPTED.store(true, Ordering::SeqCst);
|
|
}
|