Index: runtime/bin/eventhandler_win.cc |
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc |
index 3b12d940847b641f4714086de811f645bd2da436..3fb27c7ff5b94bdc87510d145818eeff0d7415d9 100644 |
--- a/runtime/bin/eventhandler_win.cc |
+++ b/runtime/bin/eventhandler_win.cc |
@@ -417,6 +417,21 @@ bool DirectoryWatchHandle::IssueRead() { |
} |
+void DirectoryWatchHandle::Stop() { |
+ ScopedLock lock(this); |
+ // Stop the outstanding read, so we can close the handle. |
+ |
+ if (pending_read_ != NULL) { |
+ CancelIoEx(handle(), pending_read_->GetCleanOverlapped()); |
Søren Gjesse
2014/06/04 10:04:52
Check that this returns ERROR_OPERATION_ABORTED? N
Anders Johnsen
2014/06/04 10:15:53
The thing is, even if it doesn't, we can't do anyt
|
+ // Don't dispose of the buffer, as it will still complete (with length 0). |
+ pending_read_ = NULL; |
+ } |
+ |
+ CloseHandle(handle()); |
+ handle_ = (INVALID_HANDLE_VALUE); |
+} |
+ |
+ |
void SocketHandle::HandleIssueError() { |
int error = WSAGetLastError(); |
if (error == WSAECONNRESET) { |