diff options
author | Seija Kijin <doremylover123@gmail.com> | 2022-12-25 04:41:50 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-25 10:34:03 +0300 |
commit | 0006e2e3f1de6a3a5351da298ee52b5d936addfd (patch) | |
tree | da07bf621f6455a0cb825cde3ff7246fbedd39a7 /compat/win32 | |
parent | 7c2ef319c52c4997256f5807564523dfd4acdfc7 (diff) |
win32: use _endthreadex to terminate threads, not ExitThread
Because we use the C runtime and
use _beginthreadex to create pthreads,
pthread_exit MUST use _endthreadex.
Otherwise, according to Microsoft:
"Failure to do so results in small
memory leaks when the thread
calls ExitThread."
Simply put, this is not the same as ExitThread.
Signed-off-by: Seija Kijin <doremylover123@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/win32')
-rw-r--r-- | compat/win32/pthread.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h index 737983d00b..cc3221cb2c 100644 --- a/compat/win32/pthread.h +++ b/compat/win32/pthread.h @@ -66,7 +66,7 @@ pthread_t pthread_self(void); static inline void NORETURN pthread_exit(void *ret) { - ExitThread((DWORD)(intptr_t)ret); + _endthreadex((unsigned)(uintptr_t)ret); } typedef DWORD pthread_key_t; |