embassy-sync: fix clear() to wake senders

This commit is contained in:
ibuki2003 2025-01-26 17:23:41 +09:00
parent 51d87c6603
commit e2ddba92f7
No known key found for this signature in database
GPG Key ID: 44308164C3BE562C
4 changed files with 12 additions and 0 deletions

View File

@ -562,6 +562,9 @@ impl<T, const N: usize> ChannelState<T, N> {
}
fn clear(&mut self) {
if self.queue.is_full() {
self.senders_waker.wake();
}
self.queue.clear();
}

View File

@ -411,6 +411,9 @@ where
}
fn clear(&mut self) {
if self.queue.len() == self.queue.capacity() {
self.senders_waker.wake();
}
self.queue.clear();
}

View File

@ -421,6 +421,9 @@ impl<T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usize> PubSubSta
}
fn clear(&mut self) {
if self.is_full() {
self.publisher_wakers.wake();
}
self.queue.clear();
}

View File

@ -287,6 +287,9 @@ impl State {
}
fn clear(&mut self) {
if self.full {
self.receive_waker.wake();
}
self.front = 0;
self.back = 0;
self.full = false;