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:
parent
7c2ef319c5
commit
0006e2e3f1
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user