diff options
author | sebres <sebres@users.sourceforge.net> | 2017-07-13 15:46:42 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-07-13 15:46:42 (GMT) |
commit | 7f6fd62f681e2085f97018652f5c052651ac6423 (patch) | |
tree | e57f2a2d6c92f54a4c34b30b70db242c33d83fcc /generic/tclNotify.c | |
parent | c8eac8481eea1bc6ffa187cf11ec580ed87fc874 (diff) | |
parent | d08c41030e00d38de2ffbe8ff261d0a57b874eaf (diff) | |
download | tcl-7f6fd62f681e2085f97018652f5c052651ac6423.zip tcl-7f6fd62f681e2085f97018652f5c052651ac6423.tar.gz tcl-7f6fd62f681e2085f97018652f5c052651ac6423.tar.bz2 |
merge (integrate) sebres-event-perf-fix-busy-waitsebres_8_5_event_perf_branch
Diffstat (limited to 'generic/tclNotify.c')
-rw-r--r-- | generic/tclNotify.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/generic/tclNotify.c b/generic/tclNotify.c index 28c3879..1bb21b4 100644 --- a/generic/tclNotify.c +++ b/generic/tclNotify.c @@ -1526,10 +1526,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: /* @@ -1579,6 +1587,7 @@ Tcl_ServiceAll(void) * avoid recursive calls. */ + tsdPtr->serviceLevel++; tsdPtr->serviceMode = TCL_SERVICE_NONE; /* @@ -1595,23 +1604,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; } |