use std::sync::{ Arc, atomic::{AtomicBool, Ordering}, }; /// A shared stop signal for one native compilation. #[derive(Clone, Debug, Default)] pub struct Cancellation(Arc); impl Cancellation { pub fn cancel(&self) { self.0.store(true, Ordering::Release); } pub fn is_cancelled(&self) -> bool { self.0.load(Ordering::Acquire) } }