aboutsummaryrefslogtreecommitdiff
path: root/embassy-sync/src/waitqueue/multi_waker.rs
diff options
context:
space:
mode:
authorDion Dokter <[email protected]>2025-11-20 13:22:38 +0100
committerDion Dokter <[email protected]>2025-11-20 13:22:38 +0100
commit4f2c36e447455e8d33607d586859d3d075cabf1d (patch)
tree003cd822d688acd7c074dd229663b4648d100f71 /embassy-sync/src/waitqueue/multi_waker.rs
parent663732d85abbae400f2dbab2c411802a5b60e9b1 (diff)
parent661874d11de7d93ed52e08e020a9d4c7ee11122d (diff)
Merge branch 'main' into u0-lcd
Diffstat (limited to 'embassy-sync/src/waitqueue/multi_waker.rs')
-rw-r--r--embassy-sync/src/waitqueue/multi_waker.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/embassy-sync/src/waitqueue/multi_waker.rs b/embassy-sync/src/waitqueue/multi_waker.rs
index 0e520bf40..56c0cd1b2 100644
--- a/embassy-sync/src/waitqueue/multi_waker.rs
+++ b/embassy-sync/src/waitqueue/multi_waker.rs
@@ -3,6 +3,9 @@ use core::task::Waker;
3use heapless::Vec; 3use heapless::Vec;
4 4
5/// Utility struct to register and wake multiple wakers. 5/// Utility struct to register and wake multiple wakers.
6/// Queue of wakers with a maximum length of `N`.
7/// Intended for waking multiple tasks.
8#[derive(Debug)]
6pub struct MultiWakerRegistration<const N: usize> { 9pub struct MultiWakerRegistration<const N: usize> {
7 wakers: Vec<Waker, N>, 10 wakers: Vec<Waker, N>,
8} 11}
@@ -13,7 +16,9 @@ impl<const N: usize> MultiWakerRegistration<N> {
13 Self { wakers: Vec::new() } 16 Self { wakers: Vec::new() }
14 } 17 }
15 18
16 /// Register a waker. If the buffer is full the function returns it in the error 19 /// Register a waker.
20 ///
21 /// If the buffer is full, [wakes all the wakers](Self::wake), clears its buffer and registers the waker.
17 pub fn register(&mut self, w: &Waker) { 22 pub fn register(&mut self, w: &Waker) {
18 // If we already have some waker that wakes the same task as `w`, do nothing. 23 // If we already have some waker that wakes the same task as `w`, do nothing.
19 // This avoids cloning wakers, and avoids unnecessary mass-wakes. 24 // This avoids cloning wakers, and avoids unnecessary mass-wakes.