summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasiljevic <vasiljevic@noemail.net>2008-04-27 08:36:20 (GMT)
committervasiljevic <vasiljevic@noemail.net>2008-04-27 08:36:20 (GMT)
commitff12fe243202e0af10c1a14f8a80330d34be2bda (patch)
treeb71a0f66823b08e09835c1e83d0132a376b23b61
parent560ba02da4ff9b15e0a16770f9cad752ce93b1b6 (diff)
downloadtcl-ff12fe243202e0af10c1a14f8a80330d34be2bda.zip
tcl-ff12fe243202e0af10c1a14f8a80330d34be2bda.tar.gz
tcl-ff12fe243202e0af10c1a14f8a80330d34be2bda.tar.bz2
Also, panic early if we find out the wrong thread attempting
to delete the async handler (common trap). As, only the one that created the handler is allowed to delete it. FossilOrigin-Name: c9ef4f4064de5b962b5b1e56fadd36eec2cfbe66
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclAsync.c12
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f799bf0..e9e38f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@
to locate handler token fails. Happens when some other
thread attempts to delete somebody else's token.
+ Also, panic early if we find out the wrong thread attempting
+ to delete the async handler (common trap). As, only the one
+ that created the handler is allowed to delete it.
+
2008-04-24 Andreas Kupries <andreask@activestate.com>
* tests/ioCmd.test: Extended testsuite for reflected channel
diff --git a/generic/tclAsync.c b/generic/tclAsync.c
index 2fd4347..f57c456 100644
--- a/generic/tclAsync.c
+++ b/generic/tclAsync.c
@@ -11,7 +11,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.14 2008/04/26 11:53:24 vasiljevic Exp $
+ * RCS: @(#) $Id: tclAsync.c,v 1.15 2008/04/27 08:36:20 vasiljevic Exp $
*/
#include "tclInt.h"
@@ -262,7 +262,7 @@ Tcl_AsyncInvoke(
* Failure to locate the handler in current thread private list
* of async handlers will result in panic; exception: the list
* is already empty (potential trouble?).
- * Consequently, threads should create and delete handlers
+ * Consequently, threads should create and delete handlers
* themselves. I.e. a handler created by one should not be
* deleted by some other thread.
*
@@ -278,6 +278,14 @@ Tcl_AsyncDelete(
AsyncHandler *prevPtr, *thisPtr;
/*
+ * Assure early handling of the constraint
+ */
+
+ if (asyncPtr->originThrdId != Tcl_GetCurrentThread()) {
+ panic("Tcl_AsyncDelete: async handler deleted by the wrong thread");
+ }
+
+ /*
* If we come to this point when TSD's for the current
* thread have already been garbage-collected, we are
* in the _serious_ trouble. OTOH, we tolerate calling