Skip to content

Conversation

@martin-g
Copy link
Member

Motivation

Since watch is a multi-producer channel its documentation should talk about many/all Senders.

Solution

Update the documentation for Receiver::changed() that RecvError will be returned only when all senders are dropped.

Since `watch` is a multi-producer channel its documentation should talk
about many/all Senders.
RecvError will be returned only when all senders are dropped
@github-actions github-actions bot added the R-loom-sync Run loom sync tests on this PR label Sep 10, 2025
Copy link
Member

@ADD-SP ADD-SP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to combine #7600 and #7601 into a single PR, as they both change the tokio::sync::watch docs.

@martin-g
Copy link
Member Author

Done! I applied the commit from #7600 here

@martin-g martin-g marked this pull request as draft September 10, 2025 06:38
@martin-g
Copy link
Member Author

Changed to Draft because it seems there are more doc items to update

…ed only when all senders and all receivers are dropped
@Darksonn Darksonn added T-docs Topic: documentation A-tokio Area: The main tokio crate M-sync Module: tokio/sync labels Sep 10, 2025
@martin-g martin-g marked this pull request as ready for review September 10, 2025 07:17
…osed only when all senders in the watch channel are closed
@martin-g martin-g force-pushed the RecvError-if-all-senders-are-dropped branch from 1d6458b to c60f83e Compare September 10, 2025 07:24
@martin-g
Copy link
Member Author

The PR is ready for review.

Co-authored-by: Alice Ryhl <aliceryhl@google.com>
Copy link
Member

@ADD-SP ADD-SP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@ADD-SP ADD-SP changed the title sync: Improve the documentation of channel::watch() change notifications sync: improve the docs of sync::watch Sep 15, 2025
@ADD-SP ADD-SP merged commit 5f3f5b0 into tokio-rs:master Sep 15, 2025
91 checks passed
@martin-g martin-g deleted the RecvError-if-all-senders-are-dropped branch September 15, 2025 11:57
@Darksonn Darksonn mentioned this pull request Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate M-sync Module: tokio/sync R-loom-sync Run loom sync tests on this PR T-docs Topic: documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants