summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/threads.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mir_core/src/threads.cpp b/src/mir_core/src/threads.cpp
index 8f73d5bb4d..600d245ea5 100644
--- a/src/mir_core/src/threads.cpp
+++ b/src/mir_core/src/threads.cpp
@@ -118,8 +118,10 @@ DWORD WINAPI forkthread_r(void *arg)
callercode(cookie);
- SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
+ HANDLE hThread = GetCurrentThread();
+ SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
Thread_Pop();
+ CloseHandle(hThread);
return 0;
}
@@ -132,10 +134,8 @@ MIR_CORE_DLL(HANDLE) mir_forkthread(void(__cdecl *threadcode)(void*), void *arg)
DWORD threadID;
HANDLE hThread = CreateThread(NULL, 0, forkthread_r, &fa, 0, &threadID);
- if (hThread != NULL) {
+ if (hThread != NULL)
WaitForSingleObject(fa.hEvent, INFINITE);
- CloseHandle(hThread);
- }
CloseHandle(fa.hEvent);
return hThread;