1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-24 15:27:30 +02:00

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>
This commit is contained in:
Seija Kijin 2022-12-25 01:41:50 +00:00 committed by Junio C Hamano
parent 7c2ef319c5
commit 0006e2e3f1

View File

@ -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;