summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-08-25 11:06:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-08-25 11:06:23 +0000
commit44c47e4b9d6c532cc3e6cf2bcf9b5090396d844e (patch)
treed213713456cd2568de319d4153fa97820d6433fd /src
parent8894ea48fd4f124c2c93ddca57c95871b3e81258 (diff)
delay CloseHandle() to the thread finish
git-svn-id: http://svn.miranda-ng.org/main/trunk@17207 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/threads.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mir_core/src/threads.cpp b/src/mir_core/src/threads.cpp
index f4e247e65c..1d9cd65742 100644
--- a/src/mir_core/src/threads.cpp
+++ b/src/mir_core/src/threads.cpp
@@ -113,12 +113,13 @@ DWORD WINAPI forkthread_r(void *arg)
FORK_ARG *fa = (FORK_ARG*)arg;
pThreadFunc callercode = fa->threadcode;
void *cookie = fa->arg;
- CloseHandle(fa->hThread);
+ HANDLE hThread = fa->hThread;
Thread_Push((HINSTANCE)callercode);
SetEvent(fa->hEvent);
callercode(cookie);
+ CloseHandle(hThread);
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
Thread_Pop();
return 0;