Skip to content

Commit

Permalink
Add back the worker receivers pre-conditions (#12)
Browse files Browse the repository at this point in the history
The pre-conditions are still needed, because once the senders are closed, all `recv_option` calls will continue to yield `None`. The pre-condition stops polling the rx once it's removed.
  • Loading branch information
tzemanovic committed Nov 19, 2021
1 parent f15508e commit 3509d8a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/buffer4/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ where
// Using a biased select means the channels will be polled
// in priority order, not in a random (fair) order.
biased;
msg = recv_option(self.rx1.as_mut()) => {
msg = recv_option(self.rx1.as_mut()), if self.rx1.is_some() => {
match msg {
Some(msg) => {
let span = msg.span.clone();
Expand All @@ -162,7 +162,7 @@ where
None => self.rx1 = None,
}
}
msg = recv_option(self.rx2.as_mut()) => {
msg = recv_option(self.rx2.as_mut()), if self.rx2.is_some() => {
match msg {
Some(msg) => {
let span = msg.span.clone();
Expand All @@ -171,7 +171,7 @@ where
None => self.rx2 = None,
}
}
msg = recv_option(self.rx3.as_mut()) => {
msg = recv_option(self.rx3.as_mut()), if self.rx3.is_some() => {
match msg {
Some(msg) => {
let span = msg.span.clone();
Expand All @@ -180,7 +180,7 @@ where
None => self.rx3 = None,
}
}
msg = recv_option(self.rx4.as_mut()) => {
msg = recv_option(self.rx4.as_mut()), if self.rx4.is_some() => {
match msg {
Some(msg) => {
let span = msg.span.clone();
Expand Down

0 comments on commit 3509d8a

Please sign in to comment.