summaryrefslogtreecommitdiffstats
path: root/generic/tclAsync.c
diff options
context:
space:
mode:
authordavygrvy <davygrvy@pobox.com>2001-08-30 07:50:18 (GMT)
committerdavygrvy <davygrvy@pobox.com>2001-08-30 07:50:18 (GMT)
commit0d312be6885f036ff0654f64c2889ba806bcf07e (patch)
tree7d838c15cd14b38785a1fab0ded168b19b1f0e95 /generic/tclAsync.c
parentfce8b6f68f556617c82dd0079a82f02e751e17db (diff)
downloadtcl-0d312be6885f036ff0654f64c2889ba806bcf07e.zip
tcl-0d312be6885f036ff0654f64c2889ba806bcf07e.tar.gz
tcl-0d312be6885f036ff0654f64c2889ba806bcf07e.tar.bz2
* generic/tclAsync.c:
* generic/tclEvent.c: * generic/tclInt.h: Improper cleanup of asyncMutex in tclAsync.c repaired. TclFinalizeSynchronization() was trying to remove a registered mutex that was dumped earlier when the TSD it was stored in was cleared. This was only surfacing on *nix. Windows was being masked by mutexes not actually being returned to the system! That was repaired in a previous patch. Needed to add a private TclFinalizeAsync() to tclAsync.c and called from Tcl_FinalizeThread(). Pheww.. Is this done yet? [Bug: 414419] requested by Rob Ratcliff <rrr6399@futuretek.com>
Diffstat (limited to 'generic/tclAsync.c')
-rw-r--r--generic/tclAsync.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/generic/tclAsync.c b/generic/tclAsync.c
index 8d6757f..76e3e28 100644
--- a/generic/tclAsync.c
+++ b/generic/tclAsync.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclAsync.c,v 1.5 2000/07/26 01:28:35 davidg Exp $
+ * RCS: @(#) $Id: tclAsync.c,v 1.6 2001/08/30 07:50:18 davygrvy Exp $
*/
#include "tclInt.h"
@@ -72,9 +72,7 @@ typedef struct ThreadSpecificData {
int asyncActive;
-#ifdef TCL_THREADS
Tcl_Mutex asyncMutex; /* Thread-specific AsyncHandler linked-list lock */
-#endif
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -83,6 +81,33 @@ static Tcl_ThreadDataKey dataKey;
/*
*----------------------------------------------------------------------
*
+ * TclFinalizeAsync --
+ *
+ * Finalizes the mutex in the thread local data structure for the
+ * async subsystem.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Forgets knowledge of the mutex should it have been created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TclFinalizeAsync()
+{
+ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
+
+ if (tsdPtr->asyncMutex != NULL) {
+ Tcl_MutexFinalize(&tsdPtr->asyncMutex);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* Tcl_AsyncCreate --
*
* This procedure creates the data structures for an asynchronous