channel: call notify only from one thread
@@ -221,6 +221,7 @@ impl SyncWaker {
pub fn notify(&self) {
if !self.is_empty.load(Ordering::SeqCst) {
let mut inner = self.inner.lock();
+ if !self.is_empty.load(Ordering::SeqCst) {
inner.try_select();
inner.notify();
self.is_empty.store(
@@ -229,6 +230,7 @@ impl SyncWaker {
);
}
}
+ }
/// Registers an operation waiting to be ready.
#[inline]
