os_trait/notifier.rs
1use crate::fugit::MicrosDurationU32;
2
3pub trait NotifyBuilder {
4 fn build() -> (impl Notifier, impl NotifyWaiter);
5 fn build_isr() -> (impl NotifierIsr, impl NotifyWaiter);
6}
7
8pub trait NotifierIsr: Send + Clone {
9 fn notify_from_isr(&self) -> bool;
10}
11
12pub trait Notifier: Send + Sync {
13 fn notify(&self) -> bool;
14}
15
16pub trait NotifyWaiter: Send {
17 /// Wait until notified or timeout occurs.
18 /// # Returns
19 /// - `true` notified
20 /// - `false` timeout occurred
21 fn wait(&self, timeout: MicrosDurationU32) -> bool;
22}