summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-03-03 16:41:59 -0500
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-04 14:48:46 +0100
commit8e851c1e8c8f92da41d44e15e0c75777e4d1110e (patch)
tree74be51f1f4c870fcf4933375ac8b5b483ed3a392
parent83fe60fa1bb7c8293585e6e8d6b12f3039910bbb (diff)
downloadlibgit2-8e851c1e8c8f92da41d44e15e0c75777e4d1110e.tar.gz
libgit2_shutdown: free TLS data (win32)
Free TLS data on thread exit (win32)
-rw-r--r--src/global.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/global.c b/src/global.c
index 2f31c7de4..1f3432d09 100644
--- a/src/global.c
+++ b/src/global.c
@@ -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;