Skip to content

Commit

Permalink
sync: document when watch::send fails (#4021)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn authored Aug 3, 2021
1 parent 175d84e commit e662175
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tokio/src/sync/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ impl<T> Drop for Receiver<T> {

impl<T> Sender<T> {
/// 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<T>> {
// This is pretty much only useful as a hint anyway, so synchronization isn't critical.
if 0 == self.shared.ref_count_rx.load(Relaxed) {
Expand Down

0 comments on commit e662175

Please sign in to comment.