summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-03-06 19:50:08 +0000
committerGerd Moellmann <gerd@gnu.org>2001-03-06 19:50:08 +0000
commit42e26cac36242b129c037dc8f1e7787f583e614a (patch)
tree7f210b10e42ce69a462955c042137427b83ee8d3
parent0285f2ceffa1e39bf781fefe0608a8bf34aea211 (diff)
downloademacs-42e26cac36242b129c037dc8f1e7787f583e614a.tar.gz
(XTflash): Make the timeout of select shorter, and call
select repeatedly until the desired time expires.
-rw-r--r--src/xterm.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/xterm.c b/src/xterm.c
index fc09897de01..ae786d5058b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5437,18 +5437,23 @@ XTflash (f)
wakeup.tv_sec += (wakeup.tv_usec / 1000000);
wakeup.tv_usec %= 1000000;
- /* Keep waiting until past the time wakeup. */
- while (1)
+ /* Keep waiting until past the time wakeup or any input gets
+ available. */
+ while (! detect_input_pending ())
{
+ struct timeval current;
struct timeval timeout;
- EMACS_GET_TIME (timeout);
+ EMACS_GET_TIME (current);
- /* In effect, timeout = wakeup - timeout.
- Break if result would be negative. */
- if (timeval_subtract (&timeout, wakeup, timeout))
+ /* Break if result would be negative. */
+ if (timeval_subtract (&current, wakeup, current))
break;
+ /* How long `select' should wait. */
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 10000;
+
/* Try to wait that long--but we might wake up sooner. */
select (0, NULL, NULL, NULL, &timeout);
}