-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: implement watch::Receiver::mark_unseen()
#5962
sync: implement watch::Receiver::mark_unseen()
#5962
Conversation
I'm pretty sure you can just decrement the version instead. Since whether it's seen is computed based on what the version is. |
I was thinking to change it to I was a little worried about the fact that there is also the |
watch::Receiver::mark_unseen()
watch::Receiver::mark_unseen()
You can just make the starting version be 1. Then you can always subtract one from the version. |
#[test] | ||
fn rx_mark_unseen() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like a test that actually sends a value somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
I didn't notice this PR and left some comments at the merge commit: 61042b4 |
Most crucial issue is the choice of naming which introduces "unseen" while we already have |
Hi @uklotzde, sounds reasonable. Since the change hasn't been released yet I could update the name if we want to. |
I have created a PR to prevent that this change is released accidentally: #6014 |
Got it wrong 🙈 Of course the method must be named |
Fixes: #5871
Solution
I've added an extra flag to
sync::watch::Receiver
.Mutex
is used for thread safety andCell
for interior mutability.Could try to use an
AtomicBool
instead ofMutex<Cell<bool>>
since a Receiver instance is not shared across threads?