use std::sync::{Arc, Mutex};
use ::mio::{Registry, Token};
#[derive(Clone, Debug)]
pub(crate) struct Waker {
inner: Arc<Mutex<::mio::Waker>>,
}
impl Waker {
pub(crate) fn new(registry: &Registry, waker_token: Token) -> std::io::Result<Self> {
Ok(Self {
inner: Arc::new(Mutex::new(mio::Waker::new(registry, waker_token)?)),
})
}
pub(crate) fn wake(&self) -> std::io::Result<()> {
self.inner.lock().unwrap().wake()
}
#[allow(dead_code, clippy::clippy::unnecessary_wraps)]
pub(crate) fn reset(&self) -> std::io::Result<()> {
Ok(())
}
}