Implement Drop for Stream

This commit is contained in:
Viktor Lazarev 2019-08-29 08:10:31 +02:00 committed by mitchmindtree
parent 0541bf8667
commit 7765e941ed
1 changed files with 6 additions and 1 deletions

View File

@ -148,12 +148,17 @@ impl EventLoop {
} }
} }
impl Drop for EventLoop { impl Drop for Stream {
#[inline] #[inline]
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
handleapi::CloseHandle(self.pending_scheduled_event); handleapi::CloseHandle(self.pending_scheduled_event);
} }
unsafe {
let result = synchapi::SetEvent(self.pending_scheduled_event);
assert!(result != 0);
}
self.thread.take().unwrap().join().unwrap();
} }
} }