diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/threadengine.cpp | 2 | ||||
-rw-r--r-- | src/threadengines/threadengine_pthread.cpp | 4 | ||||
-rw-r--r-- | src/threadengines/threadengine_win32.cpp | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/threadengine.cpp b/src/threadengine.cpp index 82aa78a36..bb686f084 100644 --- a/src/threadengine.cpp +++ b/src/threadengine.cpp @@ -26,7 +26,7 @@ void Thread::SetExitFlag() void Thread::join() { - state.FreeThread(this); + ServerInstance->Threads.Stop(this); } /** If this thread has a Creator set, call it to diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp index 7900e66bc..fcb4db444 100644 --- a/src/threadengines/threadengine_pthread.cpp +++ b/src/threadengines/threadengine_pthread.cpp @@ -43,10 +43,10 @@ void ThreadEngine::Start(Thread* thread) throw CoreException("Unable to create new thread: " + std::string(strerror(errno))); } -void ThreadData::FreeThread(Thread* thread) +void ThreadEngine::Stop(Thread* thread) { thread->SetExitFlag(); - pthread_join(pthread_id, NULL); + pthread_join(thread->state.pthread_id, NULL); } #ifdef HAS_EVENTFD diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp index 3376f937a..33eb707e4 100644 --- a/src/threadengines/threadengine_win32.cpp +++ b/src/threadengines/threadengine_win32.cpp @@ -42,9 +42,10 @@ DWORD WINAPI ThreadEngine::Entry(void* parameter) return 0; } -void ThreadData::FreeThread(Thread* thread) +void ThreadEngine::Stop(Thread* thread) { thread->SetExitFlag(); + HANDLE handle = thread->state.handle; WaitForSingleObject(handle,INFINITE); CloseHandle(handle); } |