diff --git a/vuinputd/src/cuse_device/state.rs b/vuinputd/src/cuse_device/state.rs index 3fd4870..d4ac899 100644 --- a/vuinputd/src/cuse_device/state.rs +++ b/vuinputd/src/cuse_device/state.rs @@ -137,6 +137,16 @@ impl PollState { } } +impl Drop for PollState { + fn drop(&mut self) { + //when the device closes, notify all pending waiters + let old_handle = self.take_waiters(); + if let Some(mut old_handle) = old_handle { + old_handle.notify(); + } + } +} + #[derive(Debug)] pub struct VuInputState { pub file: File,