libgit2_shutdown: free TLS data (win32)

Free TLS data on thread exit (win32)
This commit is contained in:
Edward Thomson 2015-03-03 16:41:59 -05:00 committed by Carlos Martín Nieto
parent 83fe60fa1b
commit 8e851c1e8c

View File

@ -270,6 +270,17 @@ git_global_st *git__global_state(void)
return ptr;
}
BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved)
{
if (reason == DLL_THREAD_DETACH) {
void *ptr = TlsGetValue(_tls_index);
git__global_state_cleanup(ptr);
git__free(ptr);
}
return TRUE;
}
#elif defined(GIT_THREADS) && defined(_POSIX_THREADS)
static pthread_key_t _tls_key;