use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use tokio::runtime::Handle;
pub async fn wait_for_interrupt(handle: Handle, interrupted: Arc<AtomicBool>) {
handle.spawn(async move {
tokio::select! {
_ = tokio::signal::ctrl_c() => {
interrupted.store(true, Ordering::Release);
}
}
});
}