Add interface to disable timer (#6695)

Co-authored-by: Derived Cat <hooyuser@outlook.com>
This commit is contained in:
Myriad-Dreamin 2025-08-04 17:08:01 +08:00 committed by GitHub
parent b825df6bbc
commit 3683399a95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -71,6 +71,14 @@ pub fn enable() {
ENABLED.store(true, Ordering::Relaxed);
}
/// Disable the timer.
#[inline]
pub fn disable() {
// We only need atomicity and no synchronization of other
// operations, so `Relaxed` is fine.
ENABLED.store(false, Ordering::Relaxed);
}
/// Whether the timer is enabled.
#[inline]
pub fn is_enabled() -> bool {