Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how watch::Sender subscribe() and closed() methods interact #6489

Closed
geeklint opened this issue Apr 16, 2024 · 0 comments · Fixed by #6490
Closed

Clarify how watch::Sender subscribe() and closed() methods interact #6489

geeklint opened this issue Apr 16, 2024 · 0 comments · Fixed by #6490
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-sync Module: tokio/sync T-docs Topic: documentation

Comments

@geeklint
Copy link

Version
Observed in docs for 1.37.0.

Description

The cancel safety section of the documentation for watch::Sender::closed reads

This method is cancel safe. Once the channel is closed, it stays closed forever and all future calls to closed will return immediately.

In the time since that documentation was written, watch::Sender::subscribe has been added, which allows re-opening the channel. That sentence should presumably be removed, and it would also be nice if the docs clarified how closed() interacts with subscribe(), particularly when called concurrently on different threads (is my assumption correct that the two methods can race and by the time closed() returns, a new Receiver may already exist?)

@geeklint geeklint added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Apr 16, 2024
@Darksonn Darksonn added M-sync Module: tokio/sync T-docs Topic: documentation labels Apr 16, 2024
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 C-bug Category: This is a bug. M-sync Module: tokio/sync T-docs Topic: documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants