From e66217575bdb91c9f180bb1a8f9d0008f3ffa35b Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 3 Aug 2021 09:38:58 +0200 Subject: [PATCH] sync: document when watch::send fails (#4021) --- tokio/src/sync/watch.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tokio/src/sync/watch.rs b/tokio/src/sync/watch.rs index 3d52e4b0a..96d1d1642 100644 --- a/tokio/src/sync/watch.rs +++ b/tokio/src/sync/watch.rs @@ -422,6 +422,9 @@ impl Drop for Receiver { impl Sender { /// Sends a new value via the channel, notifying all receivers. + /// + /// This method fails if the channel has been closed, which happens when + /// every receiver has been dropped. pub fn send(&self, value: T) -> Result<(), error::SendError> { // This is pretty much only useful as a hint anyway, so synchronization isn't critical. if 0 == self.shared.ref_count_rx.load(Relaxed) {