summaryrefslogtreecommitdiffstats
path: root/win/tclWinThrd.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinThrd.c')
-rw-r--r--win/tclWinThrd.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 10a886c..a00c672 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinThrd.c,v 1.19 2002/04/23 17:03:35 hobbs Exp $
+ * RCS: @(#) $Id: tclWinThrd.c,v 1.20 2002/08/29 19:02:19 andreas_kupries Exp $
*/
#include "tclWinInt.h"
@@ -633,15 +633,10 @@ TclpFinalizeThreadData(keyPtr)
{
VOID *result;
DWORD *indexPtr;
-#ifdef USE_THREAD_ALLOC
- static int once = 0;
- if (!once) {
- once = 1;
- TclWinFreeAllocCache();
- }
+#ifdef USE_THREAD_ALLOC
+ TclWinFreeAllocCache();
#endif
-
if (*keyPtr != NULL) {
indexPtr = *(DWORD **)keyPtr;
result = (VOID *)TlsGetValue(*indexPtr);
@@ -1039,8 +1034,10 @@ TclWinFreeAllocCache(void)
void *ptr;
ptr = TlsGetValue(key);
- TlsSetValue(key, NULL);
- TclFreeAllocCache(ptr);
+ if (ptr != NULL) {
+ TlsSetValue(key, NULL);
+ TclFreeAllocCache(ptr);
+ }
}
#endif /* USE_THREAD_ALLOC */