Struct esp_idf_hal::task::asynch::Notification
source · pub struct Notification { /* private fields */ }
Expand description
Single-slot lock-free signaling primitive supporting signalling with a u32
bit-set.
It is useful for sending data between tasks when the receiver only cares about the latest data, and therefore it’s fine to “lose” messages. This is often the case for “state” updates.
The sending part of the primitive is non-blocking, so it is also useful for notifying asynchronous tasks from contexts where blocking or async wait is not possible.
Similar in spirit to the ESP-IDF FreeRTOS task notifications in that it is light-weight and operates on bit-sets, but for synchronization between an asynchronous task, and another one, which might be blocking or asynchronous.
Implementations§
source§impl Notification
impl Notification
sourcepub fn notify_lsb(&self) -> bool
pub fn notify_lsb(&self) -> bool
Marks the least significant bit (bit 0) in this IsrNotification
as nofified.
Returns true
if there was a registered waker which got awoken.
sourcepub fn notify(&self, bits: NonZeroU32) -> bool
pub fn notify(&self, bits: NonZeroU32) -> bool
Marks the supplied bits in this Notification
as notified.
Returns true
if there was a registered waker which got awoken.
sourcepub fn notify_waker(&self, bits: NonZeroU32) -> Option<Waker>
pub fn notify_waker(&self, bits: NonZeroU32) -> Option<Waker>
A utility to help in implementing a custom wait
logic:
Adds the supplied bits as notified in the notification instance and returns the registered waker (if any).
sourcepub fn reset(&self)
pub fn reset(&self)
Clears the state of this notification by removing any registered waker and setting all bits to 0.