+ // Close on drop, which will be detected by poll in background thread
+ pipefd: Option<OwnedFd>,
+
+ // Detect when thread has completed
+ complete: Option<mpsc::Receiver<()>>,
+}
+
+impl Drop for WatchHandle {
+ fn drop(&mut self) {
+ drop(self.pipefd.take());
+ let _ = self.complete.take().unwrap().recv();
+ }