summaryrefslogtreecommitdiffstats
path: root/generic/tclAsync.c
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 /generic/tclAsync.c
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.
Diffstat (limited to 'generic/tclAsync.c')
-rw-r--r--generic/tclAsync.c12
1 files changed, 10 insertions, 2 deletions
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