diff options
Diffstat (limited to 'embassy-sync/src/waitqueue/multi_waker.rs')
| -rw-r--r-- | embassy-sync/src/waitqueue/multi_waker.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/embassy-sync/src/waitqueue/multi_waker.rs b/embassy-sync/src/waitqueue/multi_waker.rs index 0384d6bed..56c0cd1b2 100644 --- a/embassy-sync/src/waitqueue/multi_waker.rs +++ b/embassy-sync/src/waitqueue/multi_waker.rs | |||
| @@ -5,6 +5,7 @@ use heapless::Vec; | |||
| 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`. | 6 | /// Queue of wakers with a maximum length of `N`. |
| 7 | /// Intended for waking multiple tasks. | 7 | /// Intended for waking multiple tasks. |
| 8 | #[derive(Debug)] | ||
| 8 | pub struct MultiWakerRegistration<const N: usize> { | 9 | pub struct MultiWakerRegistration<const N: usize> { |
| 9 | wakers: Vec<Waker, N>, | 10 | wakers: Vec<Waker, N>, |
| 10 | } | 11 | } |
| @@ -15,7 +16,9 @@ impl<const N: usize> MultiWakerRegistration<N> { | |||
| 15 | Self { wakers: Vec::new() } | 16 | Self { wakers: Vec::new() } |
| 16 | } | 17 | } |
| 17 | 18 | ||
| 18 | /// 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. | ||
| 19 | pub fn register(&mut self, w: &Waker) { | 22 | pub fn register(&mut self, w: &Waker) { |
| 20 | // 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. |
| 21 | // This avoids cloning wakers, and avoids unnecessary mass-wakes. | 24 | // This avoids cloning wakers, and avoids unnecessary mass-wakes. |
