8000 Bug fix/fix thread shutdown by jsteemann · Pull Request #7728 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Bug fix/fix thread shutdown #7728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 11, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix thread shutdown on _WIN32
  • Loading branch information
jsteemann committed Dec 11, 2018
commit b3854d9b3f14633106e2b32a7d94c11b64e23dda
7 changes: 5 additions & 2 deletions lib/Basics/threads-win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ bool TRI_StartThread(TRI_thread_t* thread, TRI_tid_t* threadId,
////////////////////////////////////////////////////////////////////////////////

int TRI_JoinThread(TRI_thread_t* thread) {
TRI_ASSERT(thread != nullptr);
DWORD result = WaitForSingleObject(*thread, INFINITE);

switch (result) {
Expand Down Expand Up @@ -136,7 +137,8 @@ int TRI_JoinThread(TRI_thread_t* thread) {
int TRI_DetachThread(TRI_thread_t* thread) {
// If the function succeeds, the return value is nonzero.
// If the function fails, the return value is zero. To get extended error information, call GetLastError.
BOOL res = CloseHandle(thread);
TRI_ASSERT(thread != nullptr);
BOOL res = CloseHandle(*thread);

if (res == 0) {
DWORD result = GetLastError();
Expand All @@ -157,7 +159,8 @@ bool TRI_IsSelfThread(TRI_thread_t* thread) {
// TODO: Change the TRI_thread_t into a structure which stores the thread id
// as well as the thread handle. This can then be passed around
// ...........................................................................
return (GetCurrentThreadId() == GetThreadId(thread));
TRI_ASSERT(thread != nullptr);
return (GetCurrentThreadId() == GetThreadId(*thread));
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
0