unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 35400@debbugs.gnu.org
Subject: bug#35400: 27.0.50; Timers repeated after waking from suspend
Date: Tue, 02 Feb 2021 11:18:01 -0500	[thread overview]
Message-ID: <jwvtuqumoya.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83ft2e5vu1.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 02 Feb 2021 17:32:38 +0200")

> There are two use cases here.  One is the one we have been discussing:
> when Emacs wakes from suspension, or the machine wakes from sleep.
> The other is that somehow Emacs didn't get CPU to run, due to some
> expensive processing on the system.

Or also that Emacs did get the CPU but used it for itself running ELisp
code without stopping.

It could even be that the code it ran was the code for an earlier
invocation of that same timer.

> So maybe this should be a property of the timer itself?

I do think so, yes, but I think to fix it right we need to take a step
back and think about what it is we really want to happen, and then see
if/how we can retrofit it into the current design.

I think for the case where we missed some timer repetitions, the best
thing we can do is not to call that timer repeatedly but instead to call
it once and pass it the number of times it has fired since the last time
we ran it (so it can then freely decide to repeat its operation N times
or not).

A related issue is that for many timers, rather than "repeat every
N seconds" we'd rather want "wait N seconds between invocations" (so if
the execution of the timer terminates M seconds after the time T it was
supposed to start running, the next execution should not be scheduled
for T+N but T+M+N).


        Stefan






  reply	other threads:[~2021-02-02 16:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 16:59 bug#35400: 27.0.50; Timers repeated after waking from suspend Stefan Monnier
2019-04-23 17:30 ` Eli Zaretskii
2021-02-02 14:34   ` Lars Ingebrigtsen
2021-02-02 15:32     ` Eli Zaretskii
2021-02-02 16:18       ` Stefan Monnier [this message]
2021-02-03 18:42         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvtuqumoya.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=35400@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).