Skip to content

Commit

Permalink
Add Semaphore bound for closed impl
Browse files Browse the repository at this point in the history
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
  • Loading branch information
zaharidichev committed Sep 25, 2020
1 parent edd97a2 commit 19bfab1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tokio/src/sync/mpsc/chan.rs
Expand Up @@ -136,6 +136,13 @@ impl<T, S> Tx<T, S> {
self.inner.send(value);
}

/// Wake the receive half
pub(crate) fn wake_rx(&self) {
self.inner.rx_waker.wake();
}
}

impl<T, S: Semaphore> Tx<T, S> {
pub(crate) async fn closed(&mut self) {
use std::future::Future;
use std::pin::Pin;
Expand All @@ -162,11 +169,6 @@ impl<T, S> Tx<T, S> {
}
notified.await;
}

/// Wake the receive half
pub(crate) fn wake_rx(&self) {
self.inner.rx_waker.wake();
}
}

impl<T, S> Clone for Tx<T, S> {
Expand Down

0 comments on commit 19bfab1

Please sign in to comment.