summaryrefslogtreecommitdiffstats
path: root/generic/tclThread.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-05-01 22:43:49 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-05-01 22:43:49 (GMT)
commit17b8d2d3e3ac333f60da3b27fc34190d212670dd (patch)
treec96aa1e1faf9a0d0ba901be5c85b7737cafc1fce /generic/tclThread.c
parent2ac57a490ebcd5bd43e7f03e705a243ce67ffa37 (diff)
downloadtcl-17b8d2d3e3ac333f60da3b27fc34190d212670dd.zip
tcl-17b8d2d3e3ac333f60da3b27fc34190d212670dd.tar.gz
tcl-17b8d2d3e3ac333f60da3b27fc34190d212670dd.tar.bz2
* generic/tclIO.c (DeleteChannelTable): Made changes so that
DeleteChannelTable tries to close all open channels, not just the first. [Bug 1710285] * generic/tclThread.c (TclFinalizeSynchronization): Make sure that TSD blocks get freed on non-threaded builds. [Bug 1710825]
Diffstat (limited to 'generic/tclThread.c')
-rw-r--r--generic/tclThread.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/generic/tclThread.c b/generic/tclThread.c
index 9372d78..60c09ca 100644
--- a/generic/tclThread.c
+++ b/generic/tclThread.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: tclThread.c,v 1.15 2006/11/07 14:26:26 dkf Exp $
+ * RCS: @(#) $Id: tclThread.c,v 1.16 2007/05/01 22:43:50 kennykb Exp $
*/
#include "tclInt.h"
@@ -357,32 +357,34 @@ TclFinalizeThreadData(void)
void
TclFinalizeSynchronization(void)
{
-#ifdef TCL_THREADS
+ int i;
void *blockPtr;
Tcl_ThreadDataKey *keyPtr;
+#ifdef TCL_THREADS
Tcl_Mutex *mutexPtr;
Tcl_Condition *condPtr;
- int i;
TclpMasterLock();
+#endif
/*
* If we're running unthreaded, the TSD blocks are simply stored inside
* their thread data keys. Free them here.
*/
- for (i=0 ; i<keyRecord.num ; i++) {
- keyPtr = (Tcl_ThreadDataKey *) keyRecord.list[i];
- blockPtr = (void *) *keyPtr;
- ckfree(blockPtr);
- }
if (keyRecord.list != NULL) {
+ for (i=0 ; i<keyRecord.num ; i++) {
+ keyPtr = (Tcl_ThreadDataKey *) keyRecord.list[i];
+ blockPtr = (void *) *keyPtr;
+ ckfree(blockPtr);
+ }
ckfree((char *) keyRecord.list);
keyRecord.list = NULL;
}
keyRecord.max = 0;
keyRecord.num = 0;
-
+
+#ifdef TCL_THREADS
/*
* Call thread storage master cleanup.
*/
@@ -416,13 +418,6 @@ TclFinalizeSynchronization(void)
condRecord.num = 0;
TclpMasterUnlock();
-#else /* TCL_THREADS */
- if (keyRecord.list != NULL) {
- ckfree((char *) keyRecord.list);
- keyRecord.list = NULL;
- }
- keyRecord.max = 0;
- keyRecord.num = 0;
#endif /* TCL_THREADS */
}