summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2015-10-24 18:59:50 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2015-10-24 18:59:50 (GMT)
commit017fb881aae30f42cae7170c25ca3e32fd71ce33 (patch)
treeb78ac3cf2a8fa340ab9ec2b789ddbfca1a1a9e2e /generic
parent4174e5c5cc258660142a1912dd563a05272d50ba (diff)
downloadtcl-017fb881aae30f42cae7170c25ca3e32fd71ce33.zip
tcl-017fb881aae30f42cae7170c25ca3e32fd71ce33.tar.gz
tcl-017fb881aae30f42cae7170c25ca3e32fd71ce33.tar.bz2
Make the async-interrupt tests work more reliably.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclExecute.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index f6dfc46..853c0d6 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -2116,9 +2116,14 @@ TEBCresume(
* sporadically: no special need for speed.
*/
- int instructionCount = ASYNC_CHECK_COUNT;
+ unsigned interruptCounter = 1;
/* Counter that is used to work out when to
- * call Tcl_AsyncReady() */
+ * call Tcl_AsyncReady(). This must be 1
+ * initially so that we call the async-check
+ * stanza early, otherwise there are command
+ * sequences that can make the interpreter
+ * busy-loop without an opportunity to
+ * recognise an interrupt. */
const char *curInstName;
#ifdef TCL_COMPILE_DEBUG
int traceInstructions; /* Whether we are doing instruction-level
@@ -2319,8 +2324,8 @@ TEBCresume(
* ASYNC_CHECK_COUNT instructions.
*/
- if (!(--instructionCount)) {
- instructionCount = ASYNC_CHECK_COUNT;
+ if ((--interruptCounter) == 0) {
+ interruptCounter = ASYNC_CHECK_COUNT;
DECACHE_STACK_INFO();
if (TclAsyncReady(iPtr)) {
result = Tcl_AsyncInvoke(interp, result);