fix for non terminanting debounced watcher#170
Conversation
src/debounce/timer.rs
Outdated
| Action::Stop => return false | ||
| } | ||
| } | ||
| true |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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();
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
fixes #169