help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Repeating timers and suspending the computer


From: Eli Zaretskii
Subject: Re: Repeating timers and suspending the computer
Date: Fri, 09 Dec 2022 09:25:34 +0200

> From: Marcin Borkowski <mbork@mbork.pl>
> Date: Fri, 09 Dec 2022 06:20:22 +0100
> 
> assume that I said
> 
> (run-with-timer 0 1
>                 (lambda () (message "%s" (format-time-string 
> "%H:%M:%S.%3N"))))
> 
> and put my laptop in the "sleep mode" for 20 seconds.  How many time
> messages should I get?  Assume `timer-max-repeats' is 10 (which seems to
> be the default).
> 
> When I did the experiment, it seemed that the timer'd function was run
> /twice/ after waking up, which looks really strange -- why two times?

I think you have some implicit mental model of what happens when the
number of delayed invocations of the timer function exceeds that
limit, a model that you didn't describe.  You seem to be assuming that
you will get those 10 invocations, and no more, is that right?  But
that is not the only possible way of dealing with this situation.  In
fact, it isn't even smart: if time has jumped far ahead, why should
Emacs give you 10 useless invocations of the timer?

Or if you were expecting something else, please tell what you expected
and why.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]