From: Lars Ingebrigtsen <larsi@gnus.org>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 14820@debbugs.gnu.org
Subject: bug#14820: 24.3; elisp manual: How to write good idle timer worker functions?
Date: Wed, 26 Jan 2022 18:41:41 +0100 [thread overview]
Message-ID: <878rv2pf6y.fsf@gnus.org> (raw)
In-Reply-To: <51DABDE6.10904@orcon.net.nz> (Phil Sainty's message of "Tue, 09 Jul 2013 01:25:58 +1200")
Phil Sainty <psainty@orcon.net.nz> writes:
> There is a substantial amount of work to perform 'in the background',
> taking (in total) in excess of 10 seconds to complete, and also
> needing to be run on a semi-regular basis, so making the user wait
> each time is out of the question. I wish to perform the work in idle
> time, as quickly as possible, but without disrupting the user.
>
> The work can be broken down into a queue of small items, each of which
> takes a fraction of a second to complete.
[...]
> The quote above indicates that `input-pending-p' is not sufficient to
> detect all kinds of pending activity, but it doesn't suggest other
> options.
(I'm going through old bug reports that unfortunately weren't resolved
at the time.)
I think that these days, you'd probably implement this using Emacs
threads, but I think the general advice in that node is still sound --
if you're doing something that takes a long time from an idle hook, you
should instead schedule a new idle timer (with a very short timeout)
instead of trying to use `pending-input-p' and `sit-for'.
So I'm not sure whether there's anything more to do in this bug report?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2022-01-26 17:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-08 13:25 bug#14820: 24.3; elisp manual: How to write good idle timer worker functions? Phil Sainty
2013-07-10 8:35 ` Stefan Monnier
2013-07-10 15:31 ` Phil Sainty
2013-07-11 13:39 ` Daimrod
2013-07-13 6:38 ` Phil Sainty
2013-07-11 22:52 ` Stefan Monnier
2022-01-26 17:41 ` Lars Ingebrigtsen [this message]
2022-02-23 20:15 ` 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=878rv2pf6y.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=14820@debbugs.gnu.org \
--cc=psainty@orcon.net.nz \
/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).