Mercurial > emacs
changeset 36599:3813a1116259
(XTflash): Make the timeout of select shorter, and call
select repeatedly until the desired time expires.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 06 Mar 2001 19:50:08 +0000 |
parents | 3f0686c0b976 |
children | 8bca7ba48fd4 |
files | src/xterm.c |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xterm.c Tue Mar 06 19:39:03 2001 +0000 +++ b/src/xterm.c Tue Mar 06 19:50:08 2001 +0000 @@ -5437,18 +5437,23 @@ 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); - - /* In effect, timeout = wakeup - timeout. - Break if result would be negative. */ - if (timeval_subtract (&timeout, wakeup, timeout)) + EMACS_GET_TIME (current); + + /* Break if result would be negative. */ + if (timeval_subtract (¤t, 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); }