summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-08-21 16:22:19 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-08-21 16:22:19 +0000
commite1b5da6416e0c12378554a33f21a92b0a14593e9 (patch)
tree1f665d828a00a4c3a91b880d3564724881942ebe /win32
parenta4eb266fccae11165d7886ace97009e8b6569d84 (diff)
downloadperl-e1b5da6416e0c12378554a33f21a92b0a14593e9.tar.gz
free TLS slot properly on Windows
p4raw-id: //depot/perl@6748
Diffstat (limited to 'win32')
-rw-r--r--win32/perllib.c4
-rw-r--r--win32/win32thread.h5
2 files changed, 9 insertions, 0 deletions
diff --git a/win32/perllib.c b/win32/perllib.c
index fae334608f..e2b245d84f 100644
--- a/win32/perllib.c
+++ b/win32/perllib.c
@@ -372,6 +372,10 @@ DllMain(HANDLE hModule, /* DLL module handle */
*/
case DLL_PROCESS_DETACH:
EndSockets();
+#if defined(USE_THREADS) || defined(USE_ITHREADS)
+ if (PL_curinterp)
+ FREE_THREAD_KEY;
+#endif
break;
/* The attached process creates a new thread. */
diff --git a/win32/win32thread.h b/win32/win32thread.h
index 809e0f7212..a52118b48e 100644
--- a/win32/win32thread.h
+++ b/win32/win32thread.h
@@ -175,6 +175,11 @@ END_EXTERN_C
} \
} STMT_END
+#define FREE_THREAD_KEY \
+ STMT_START { \
+ TlsFree(PL_thr_key); \
+ } STMT_END
+
#if defined(USE_RTL_THREAD_API) && !defined(_MSC_VER)
#define JOIN(t, avp) \
STMT_START { \