Skip to content

Commit

Permalink
CloseHandle docs says that the return is non-zero, does not say TRUE(1)
Browse files Browse the repository at this point in the history
Summary:
say it is TRUE(1). Add assert.
Closes facebook#3630

Differential Revision: D7346895

Pulled By: ajkr

fbshipit-source-id: a46075aa4dd89f32520230606adecccecc874cdf
  • Loading branch information
yuslepukhin authored and facebook-github-bot committed Mar 21, 2018
1 parent 93d5269 commit 61785c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions port/win/win_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ void WindowsThread::join() {
"WaitForSingleObjectFailed: thread join");
}

CloseHandle(reinterpret_cast<HANDLE>(data_->handle_));
BOOL rc;
rc = CloseHandle(reinterpret_cast<HANDLE>(data_->handle_));
assert(rc != 0);
data_->handle_ = 0;
}

Expand All @@ -154,7 +156,7 @@ bool WindowsThread::detach() {
BOOL ret = CloseHandle(reinterpret_cast<HANDLE>(data_->handle_));
data_->handle_ = 0;

return (ret == TRUE);
return (ret != 0);
}

void WindowsThread::swap(WindowsThread& o) {
Expand Down

0 comments on commit 61785c7

Please sign in to comment.