mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 06:51:09 +00:00
Merge pull request #3699 from libgit2/cmn/win32-free-tls
win32: free thread-local data on thread exit
This commit is contained in:
commit
ec5a43b60a
14
src/global.c
14
src/global.c
@ -226,6 +226,20 @@ void git__free_tls_data(void)
|
|||||||
TlsSetValue(_tls_index, NULL);
|
TlsSetValue(_tls_index, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
{
|
||||||
|
/* This is how Windows lets us know our thread is being shut down */
|
||||||
|
if (fdwReason == DLL_THREAD_DETACH) {
|
||||||
|
git__free_tls_data();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Windows pays attention to this during library loading. We don't do anything
|
||||||
|
* so we trivially succeed.
|
||||||
|
*/
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(GIT_THREADS) && defined(_POSIX_THREADS)
|
#elif defined(GIT_THREADS) && defined(_POSIX_THREADS)
|
||||||
|
|
||||||
static pthread_key_t _tls_key;
|
static pthread_key_t _tls_key;
|
||||||
|
Loading…
Reference in New Issue
Block a user