diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-01-21 16:18:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-21 16:18:58 +0100 |
commit | ad633b6c9c08fb79cd5a188ecd53b4edeff21ca9 (patch) | |
tree | 1b2210e4aa9f363d313132bdeba68193925342ff | |
parent | 52f9cb37ca2483af6c90387eb606cbc0017bb7c6 (diff) | |
parent | e65bce3083d75b759dadd5ac49e7bf4a9a3b3ee0 (diff) |
Merge pull request #25117 from dragmz/patch-6
Replace CreateThread with QueueUserWorkItem
-rw-r--r-- | drivers/windows/thread_windows.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp index 1bcd5a10d4..8a2992e0c2 100644 --- a/drivers/windows/thread_windows.cpp +++ b/drivers/windows/thread_windows.cpp @@ -52,6 +52,7 @@ DWORD ThreadWindows::thread_callback(LPVOID userdata) { t->id = (ID)GetCurrentThreadId(); // must implement t->callback(t->user); + SetEvent(t->handle); ScriptServer::thread_exit(); @@ -63,13 +64,9 @@ Thread *ThreadWindows::create_func_windows(ThreadCreateCallback p_callback, void ThreadWindows *tr = memnew(ThreadWindows); tr->callback = p_callback; tr->user = p_user; - tr->handle = CreateThread( - NULL, // default security attributes - 0, // use default stack size - thread_callback, // thread function name - tr, // argument to thread function - 0, // use default creation flags - NULL); // returns the thread identifier + tr->handle = CreateEvent(NULL, TRUE, FALSE, NULL); + + QueueUserWorkItem(thread_callback, tr, WT_EXECUTELONGFUNCTION); return tr; } |