diff options
author | sebres <sebres@users.sourceforge.net> | 2017-07-03 13:31:45 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-07-03 13:31:45 (GMT) |
commit | 06f9fcd88b1e4a25a0a4c87a3ed1e7ec2e0ebf31 (patch) | |
tree | d7452f7b0f058a76c4739074c702475b3a276a48 /generic/tclTimer.c | |
parent | e7a4988c734f8a14028c271d4c6b147cbc6e635a (diff) | |
download | tcl-06f9fcd88b1e4a25a0a4c87a3ed1e7ec2e0ebf31.zip tcl-06f9fcd88b1e4a25a0a4c87a3ed1e7ec2e0ebf31.tar.gz tcl-06f9fcd88b1e4a25a0a4c87a3ed1e7ec2e0ebf31.tar.bz2 |
fixed timer-marker handling: timer should be always executed after queued event (of the same generation), it was marked (be sure it marked to immediate execution in corresponding checkProc only).
tclIO: scheduled event rewritten using Tcl_Event instead of timer event (IO is not timer, e. g. executed also by usage of `vwait -notimer ...`, etc).
Diffstat (limited to 'generic/tclTimer.c')
-rw-r--r-- | generic/tclTimer.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/generic/tclTimer.c b/generic/tclTimer.c index bb13c39..9c80332 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -918,7 +918,6 @@ TimerSetupProc( { Tcl_Time blockTime; ThreadSpecificData *tsdPtr = (ThreadSpecificData *)data; - Tcl_WideInt entryTime = 0; if (tsdPtr == NULL) { tsdPtr = InitTimer(); }; @@ -941,7 +940,7 @@ TimerSetupProc( */ Tcl_WideInt now = TclpGetMicroseconds(); - entryTime = 0x7FFFFFFFFFFFFFFFL; + Tcl_WideInt entryTime = 0x7FFFFFFFFFFFFFFFL; if (tsdPtr->relTimerList) { entryTime = TimerGetDueTime(tsdPtr, @@ -973,14 +972,6 @@ TimerSetupProc( return; } - /* - * If the first timer has expired, stick an event on the queue right now. - */ - if (!tsdPtr->timerPending && entryTime <= 0) { - TclSetTimerEventMarker(0); - tsdPtr->timerPending = 1; - } - Tcl_SetMaxBlockTime(&blockTime); } @@ -1015,20 +1006,18 @@ TimerCheckProc( if (tsdPtr == NULL) { tsdPtr = InitTimer(); }; - /* If already pending (or no timer-events) */ - if (tsdPtr->timerPending) { - return; - } - if (tsdPtr->promptList) { + /* If already pending (or prompt-events) */ + if (tsdPtr->timerPending || tsdPtr->promptList) { goto mark; } - if (!tsdPtr->relTimerList && !tsdPtr->absTimerList) { - return; - } /* * Verify the first timer on the queue. */ + + if (!tsdPtr->relTimerList && !tsdPtr->absTimerList) { + return; + } entryTime = 0x7FFFFFFFFFFFFFFFL; now = TclpGetMicroseconds(); if (tsdPtr->relTimerList) { @@ -1051,9 +1040,9 @@ TimerCheckProc( /* * If the first timer has expired, stick an event on the queue. */ - if (!tsdPtr->timerPending && entryTime <= 0) { + if (entryTime <= 0) { mark: - TclSetTimerEventMarker(0); + TclSetTimerEventMarker(flags); /* force timer execution */ tsdPtr->timerPending = 1; } } |