mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 05:45:19 +01:00
rtic-sync: add explicit check for being closed
This commit is contained in:
parent
84c7ad186e
commit
36c574019f
1 changed files with 4 additions and 0 deletions
|
|
@ -332,6 +332,10 @@ impl<T, const N: usize> Sender<'_, T, N> {
|
||||||
let idx = poll_fn(|cx| {
|
let idx = poll_fn(|cx| {
|
||||||
// Do all this in one critical section, else there can be race conditions
|
// Do all this in one critical section, else there can be race conditions
|
||||||
critical_section::with(|cs| {
|
critical_section::with(|cs| {
|
||||||
|
if self.is_closed() {
|
||||||
|
return Poll::Ready(Err(()));
|
||||||
|
}
|
||||||
|
|
||||||
let wq_empty = self.0.wait_queue.is_empty();
|
let wq_empty = self.0.wait_queue.is_empty();
|
||||||
let freeq_empty = self.0.access(cs).freeq.is_empty();
|
let freeq_empty = self.0.access(cs).freeq.is_empty();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue