use ax_task::sync::irq::{IrqWaitCell, IrqWorkerWaiter};
pub(super) struct QueueNotification {
event: IrqWaitCell,
}
impl QueueNotification {
pub(super) const fn new() -> Self {
Self {
event: IrqWaitCell::new(),
}
}
pub(super) fn notify(&self) {
let _result = self.event.notify();
}
pub(super) fn wait(&self, waiter: &IrqWorkerWaiter) {
waiter
.wait(&self.event)
.unwrap_or_else(|error| panic!("network queue executor notification failed: {error}"));
}
pub(super) fn wait_timeout(&self, waiter: &IrqWorkerWaiter, timeout: core::time::Duration) {
let _timed_out = waiter
.wait_timeout(&self.event, timeout)
.unwrap_or_else(|error| panic!("network queue executor notification failed: {error}"));
}
}