From 3b541d36702481b2374f7beb69b07d546ef7568a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 14 Oct 2022 18:13:19 +0800 Subject: [PATCH] Thread: fix compile errors --- src/common/thread.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/thread.h b/src/common/thread.h index 3c80f84fd..035ff9350 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -14,9 +14,9 @@ typedef SRWLOCK FFThreadMutex; static inline void ffThreadMutexLock(FFThreadMutex* mutex) { AcquireSRWLockExclusive(mutex); } static inline void ffThreadMutexUnlock(FFThreadMutex* mutex) { ReleaseSRWLockExclusive(mutex); } - static inline void ffThreadCreateAndDetach(__stdcall unsigned (* func)(void*), void* data) { - uintptr_t newThread = _beginthreadex(func, 0, data, NULL, 0, NULL); - if(newThread != 0) + static inline void ffThreadCreateAndDetach(unsigned (__stdcall* func)(void*), void* data) { + uintptr_t newThread = _beginthreadex(NULL, 0, func, data, 0, NULL); + if(newThread) CloseHandle((HANDLE)newThread); } #define FF_THREAD_ENTRY_DECL_WRAPPER(fn, paramType) static __stdcall unsigned fn ## ThreadMain (void* data) { fn((paramType)data); return 0; }