From 19bfab1ae19bc63f1d017047da8529c0d4c26460 Mon Sep 17 00:00:00 2001 From: Zahari Dichev Date: Fri, 25 Sep 2020 09:25:48 +0300 Subject: [PATCH] Add Semaphore bound for closed impl Signed-off-by: Zahari Dichev --- tokio/src/sync/mpsc/chan.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tokio/src/sync/mpsc/chan.rs b/tokio/src/sync/mpsc/chan.rs index 001f4b13df5..e7b951ed733 100644 --- a/tokio/src/sync/mpsc/chan.rs +++ b/tokio/src/sync/mpsc/chan.rs @@ -136,6 +136,13 @@ impl Tx { self.inner.send(value); } + /// Wake the receive half + pub(crate) fn wake_rx(&self) { + self.inner.rx_waker.wake(); + } +} + +impl Tx { pub(crate) async fn closed(&mut self) { use std::future::Future; use std::pin::Pin; @@ -162,11 +169,6 @@ impl Tx { } notified.await; } - - /// Wake the receive half - pub(crate) fn wake_rx(&self) { - self.inner.rx_waker.wake(); - } } impl Clone for Tx {