summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2008-04-27 08:36:20 (GMT)
committervasiljevic <zv@archiware.com>2008-04-27 08:36:20 (GMT)
commita85067c3276c504baded33ddeaab0f61f8dad6f1 (patch)
treeb71a0f66823b08e09835c1e83d0132a376b23b61
parent99a92c56e27cbad54bae820d66f83a04065da5e6 (diff)
downloadtcl-a85067c3276c504baded33ddeaab0f61f8dad6f1.zip
tcl-a85067c3276c504baded33ddeaab0f61f8dad6f1.tar.gz
tcl-a85067c3276c504baded33ddeaab0f61f8dad6f1.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.
-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