summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclNotify.c29
-rw-r--r--generic/tclTimer.c1
2 files changed, 22 insertions, 8 deletions
diff --git a/generic/tclNotify.c b/generic/tclNotify.c
index 9d7c225..a90417c 100644
--- a/generic/tclNotify.c
+++ b/generic/tclNotify.c
@@ -1544,10 +1544,18 @@ Tcl_DoOneEvent(
*/
result = 0;
- if (blockTimeWasSet) {
+ if ((flags & TCL_DONT_WAIT) || blockTimeWasSet) {
break;
}
- } while ( !(flags & TCL_DONT_WAIT) );
+
+ /*
+ * Reset block time before continue event-cycle.
+ */
+ if (tsdPtr->blockTimeServLev < tsdPtr->serviceLevel) {
+ tsdPtr->blockTimeSet = 0;
+ tsdPtr->blockTimeServLev = 0;
+ }
+ } while (1);
done:
/*
@@ -1598,6 +1606,7 @@ Tcl_ServiceAll(void)
* avoid recursive calls.
*/
+ tsdPtr->serviceLevel++;
tsdPtr->serviceMode = TCL_SERVICE_NONE;
/*
@@ -1614,23 +1623,29 @@ Tcl_ServiceAll(void)
* so we can avoid multiple changes.
*/
+ tsdPtr->inTraversal++;
tsdPtr->blockTimeSet = 0;
+ tsdPtr->blockTimeServLev = 0;
SetUpEventSources(tsdPtr, TCL_ALL_EVENTS);
CheckEventSources(tsdPtr, TCL_ALL_EVENTS);
- while (Tcl_ServiceEvent(0)) {
+ if (Tcl_ServiceEvent(0)) {
+ while (Tcl_ServiceEvent(0)) {};
result = 1;
}
if (TclServiceIdle()) {
result = 1;
}
- if (!tsdPtr->blockTimeSet) {
- Tcl_SetTimer(NULL);
- } else {
- Tcl_SetTimer(&tsdPtr->blockTime);
+ if (tsdPtr->inTraversal-- <= 1) {
+ if (!tsdPtr->blockTimeSet) {
+ Tcl_SetTimer(NULL);
+ } else {
+ Tcl_SetTimer(&tsdPtr->blockTime);
+ }
}
+ tsdPtr->serviceLevel--;
tsdPtr->serviceMode = TCL_SERVICE_ALL;
return result;
}
diff --git a/generic/tclTimer.c b/generic/tclTimer.c
index 81e79aa..ef783f3 100644
--- a/generic/tclTimer.c
+++ b/generic/tclTimer.c
@@ -1216,7 +1216,6 @@ TclServiceTimerEvents(void)
/* be sure that timer-list was not changed inside the proc call */
if (currentEpoch != tsdPtr->timerListEpoch) {
/* timer-list was changed - stop processing */
- tsdPtr->timerPending++;
break;
}
}