Is ScAreaLink::RefreshHdl run too often?
glogow at fbihome.de
Wed Jun 30 13:14:20 UTC 2021
Am 30.06.21 um 14:53 schrieb Stephan Bergmann:
> On 30/06/2021 14:36, Jan-Marek Glogowski wrote:
>> Am 30.06.21 um 14:29 schrieb Stephan Bergmann:
>>> On 29/06/2021 18:51, Noel Grandin wrote:
>>>> I have seen the same problem in another application I maintain.
>>>> My solution is that the repeat-delay time specified in my timers is
>>>> always the time between the end of one invocation of a timer, and
>>>> the start of the next invocation of that timer.
>>> Yes, but I fail to understand how that ScAreaLink -> ScRefreshTimer
>>> -> AutoTimer -> Timer -> Task inheritance chain schedules invocation.
>> Timer:: / Task::SetDeletionFlags()
>> It deactivates the Task before processing it. For Auto* that is skipped,
>> so the task remains active, its ImplSchedulerData::mnUpdateTime is
>> updated and it will be re-scheduled.
> No, that unfortunately doesn't help me at all :)
> Is my naive understanding correct that AutoTimer will call Invoke()
> about every GetTimeout() milliseconds? (Rather than doing the next call
> to Invoke() at about GetTimeout() milliseconds after the previous call
> to Invoke() finished, as we would want here?)
The Scheduler invokes the Task. If the Task is still active after
Invoke, it asks the Task, when it will be ready again, based on the time
before the Invoke and eventually updates the system timer to wakeup the
Scheduler again at the correct time.
And as seen, if the Timer takes more time then its interval, it'll turn
into an Idle.
> Then what would be the common idiom, using Timer or AutoTimer, to
> implement the behavior that we want here (assuming that this is behavior
> that we want in various places, so there should be prior art to look at
> when tackling this case)?
The easiest "fix" would be to call Start() at the end of the timer
function. Then you could also replace the AutoTimer with a Timer.
You could override the Invoke function of the AutoTimer to do that for
HTH now ;-)
More information about the LibreOffice