os_trait/notifier.rs
1use crate::fugit::MicrosDurationU32;
2
3pub trait NotifyBuilder {
4 fn build() -> (impl Notifier, impl NotifyWaiter);
5}
6
7/// This method should be able to call from task or ISR.
8/// The implementation should handle the different situations.
9pub trait Notifier: Send + Sync {
10 fn notify(&self) -> bool;
11}
12
13pub trait NotifyWaiter: Send {
14 /// Wait until notified or timeout occurs.
15 /// # Returns
16 /// - `true` notified
17 /// - `false` timeout occurred
18 fn wait(&self, timeout: MicrosDurationU32) -> bool;
19}