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

fix for non terminanting debounced watcher #170

Merged
merged 3 commits into from
Jan 19, 2019

Conversation

vemoo
Copy link
Contributor

@vemoo vemoo commented Jan 12, 2019

fixes #169

}
}
true
Copy link

Choose a reason for hiding this comment

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

Have zero idea about what's going on here, but usually channel's closure signifies the same thing as an explicit stop, so I'd expect to see false here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But you can end up there if the channel is empty.
But now that think about it I could have just handled the error case explicitly and return false for Disconnected and true for Empty.
Then on drop for WatchTimer I just have to drop the sender before the self.trigger.notify_one();

Copy link

Choose a reason for hiding this comment

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

Then on drop for WatchTimer I just have to drop the sender before the

Again, don't really understand the context, but this seems right to me: it's almost always possible to use "receiver is closed when sender is dropped" instead of an explicit Stop event. The benefit is that, after dropping the sender, you have to way to send additional messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems it doesn't work, because the Sender can't be dropped before self.trigger.notify_one(); and that needs to happen to avoid a race condition.

vemoo added 2 commits January 12, 2019 19:24
move check to break the loop
after `fire_event` to avoid possibly losing last events
@passcod passcod merged commit 6e211f7 into notify-rs:v4-legacy Jan 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants