summaryrefslogtreecommitdiffstats
path: root/tokio/src/sync/barrier.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/src/sync/barrier.rs')
-rw-r--r--tokio/src/sync/barrier.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/tokio/src/sync/barrier.rs b/tokio/src/sync/barrier.rs
index 23713251..fddb3a5b 100644
--- a/tokio/src/sync/barrier.rs
+++ b/tokio/src/sync/barrier.rs
@@ -110,9 +110,11 @@ impl Barrier {
let mut wait = self.wait.clone();
loop {
+ let _ = wait.changed().await;
+
// note that the first time through the loop, this _will_ yield a generation
// immediately, since we cloned a receiver that has never seen any values.
- if wait.recv().await >= generation {
+ if *wait.borrow() >= generation {
break;
}
}