summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2008-04-27 08:26:05 (GMT)
committervasiljevic <zv@archiware.com>2008-04-27 08:26:05 (GMT)
commit6e6d593ca2987c4f6fcfc00ec6ba19b866f5c7c2 (patch)
tree1f2afba21c0a61582eda36dd5712122afe801397
parent1fbfeae31be33fc423d361863f7cdbf1035167fe (diff)
downloadtcl-6e6d593ca2987c4f6fcfc00ec6ba19b866f5c7c2.zip
tcl-6e6d593ca2987c4f6fcfc00ec6ba19b866f5c7c2.tar.gz
tcl-6e6d593ca2987c4f6fcfc00ec6ba19b866f5c7c2.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.c17
2 files changed, 13 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 7f14005..82518bb 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 dcde29e..44ffbea 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.13.2.1 2008/04/27 08:05:39 vasiljevic Exp $
+ * RCS: @(#) $Id: tclAsync.c,v 1.13.2.2 2008/04/27 08:26:05 vasiljevic Exp $
*/
#include "tclInt.h"
@@ -278,19 +278,20 @@ 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
* with already cleaned-up handler list (should we?).
*/
- /*
- * Conservatively check the existence of the linked list of
- * registered handlers, as we may come at this point even
- * when the TSD's for the current thread have been already
- * garbage-collected.
- */
-
Tcl_MutexLock(&tsdPtr->asyncMutex);
if (tsdPtr->firstHandler != NULL) {
prevPtr = thisPtr = tsdPtr->firstHandler;