From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: Signals and input
Date: Sat, 29 Sep 2012 16:49:56 +0200 [thread overview]
Message-ID: <837grcg9yj.fsf@gnu.org> (raw)
In-Reply-To: <83lifvgvh8.fsf@gnu.org>
> Date: Thu, 27 Sep 2012 20:40:35 +0200
> From: Eli Zaretskii <eliz@gnu.org>
>
> Given this, there's something I don't understand: why do we force
> POLL_FOR_INPUT in an Emacs built for a window-system? We have this in
> keyboard.c:
>
> /* If we support a window system, turn on the code to poll periodically
> to detect C-g. It isn't actually used when doing interrupt input. */
> #ifdef HAVE_WINDOW_SYSTEM
> #define POLL_FOR_INPUT
> #endif
>
> If keyboard input and X events produce SIGIO, then why do we need to
> set up a timer that delivers SIGALRM every second of idle time for the
> purposes of polling input? Aren't those SIGALRMs gratuitous,
> conducive to race conditions, etc. etc.?
>
> What's more, HAVE_WINDOW_SYSTEM is a compile-time condition. An Emacs
> built with it defined will turn on polling even in a purely TTY
> session, which doesn't seem to be needed at all (I think).
>
> Can someone please help me see what am I missing? TIA.
Answering my own question here: the missing link is the variable
interrupt_input. It is set to 1 in init_keyboard if INTERRUPT_INPUT
is defined, and when non-zero, it effectively disables polling,
e.g. start_polling does nothing when that variable is non-zero.
If no one more knowledgeable beats me to it, I'll look into describing
this in the commentary near the beginning of keyboard.c. I think we
should have there at least a high-level description of how Emacs does
input, similarly to what xdisp.c says about the display engine.
prev parent reply other threads:[~2012-09-29 14:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-27 18:40 Signals and input Eli Zaretskii
2012-09-29 14:49 ` Eli Zaretskii [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=837grcg9yj.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.