Skip to content

Commit

Permalink
sync: explain relation between watch::Sender::{subscribe,closed} (#…
Browse files Browse the repository at this point in the history
…6490)

Signed-off-by: Alice Ryhl <[email protected]>
  • Loading branch information
Darksonn authored Apr 17, 2024
1 parent 1f6fc55 commit 9c6ff3b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tokio/src/sync/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,12 +1185,18 @@ impl<T> Sender<T> {
/// Completes when all receivers have dropped.
///
/// This allows the producer to get notified when interest in the produced
/// values is canceled and immediately stop doing work.
/// values is canceled and immediately stop doing work. Once a channel is
/// closed, the only way to reopen it is to call [`Sender::subscribe`] to
/// get a new receiver.
///
/// If the channel becomes closed for a brief amount of time (e.g., the last
/// receiver is dropped and then `subscribe` is called), then this call to
/// `closed` might return, but it is also possible that it does not "notice"
/// that the channel was closed for a brief amount of time.
///
/// # Cancel safety
///
/// This method is cancel safe. Once the channel is closed, it stays closed
/// forever and all future calls to `closed` will return immediately.
/// This method is cancel safe.
///
/// # Examples
///
Expand Down

0 comments on commit 9c6ff3b

Please sign in to comment.