From 61785c73ed2be584a3a2a50bc38a4fadeba3596e Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Tue, 20 Mar 2018 18:33:44 -0700 Subject: [PATCH] CloseHandle docs says that the return is non-zero, does not say TRUE(1) Summary: say it is TRUE(1). Add assert. Closes https://github.com/facebook/rocksdb/pull/3630 Differential Revision: D7346895 Pulled By: ajkr fbshipit-source-id: a46075aa4dd89f32520230606adecccecc874cdf --- port/win/win_thread.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/port/win/win_thread.cc b/port/win/win_thread.cc index 8c1d68a7b3..b48af2370f 100644 --- a/port/win/win_thread.cc +++ b/port/win/win_thread.cc @@ -138,7 +138,9 @@ void WindowsThread::join() { "WaitForSingleObjectFailed: thread join"); } - CloseHandle(reinterpret_cast(data_->handle_)); + BOOL rc; + rc = CloseHandle(reinterpret_cast(data_->handle_)); + assert(rc != 0); data_->handle_ = 0; } @@ -154,7 +156,7 @@ bool WindowsThread::detach() { BOOL ret = CloseHandle(reinterpret_cast(data_->handle_)); data_->handle_ = 0; - return (ret == TRUE); + return (ret != 0); } void WindowsThread::swap(WindowsThread& o) {