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

sync: make watch::send_replace infallible #4195

Merged
merged 4 commits into from
Oct 27, 2021

Conversation

Darksonn
Copy link
Contributor

I was going through the changelog while preparing a release and noticed this opportunity. I'm open to discussing whether this is a good idea.

Closes: #4165

cc @thombles

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-sync Module: tokio/sync labels Oct 26, 2021
@Darksonn Darksonn requested a review from taiki-e October 26, 2021 13:41
@taiki-e
Copy link
Member

taiki-e commented Oct 26, 2021

It seems to make sense that send_replace can take the current value at any time, considering that even if the receiver is zero when send_replace is called, we can call subscribe later to create a receiver.

tokio/src/sync/watch.rs Outdated Show resolved Hide resolved
Co-authored-by: Taiki Endo <te316e89@gmail.com>
@Darksonn Darksonn merged commit 75c0777 into master Oct 27, 2021
@Darksonn Darksonn deleted the watch-send_replace-infallible branch October 27, 2021 12:05
@thombles
Copy link

thombles commented Oct 27, 2021

Oops a bit slow responding sorry, but well spotted! That solves the problem nicely. Thank you!

oliver-giersch pushed a commit to oliver-giersch/tokio that referenced this pull request Oct 28, 2021
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Permit sending into a watch::Sender without active Receivers
3 participants