Mercurial > emacs
comparison src/xterm.c @ 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 | d9bb01d5dbbb |
children | ba5967636e33 |
comparison
equal
deleted
inserted
replaced
36598:3f0686c0b976 | 36599:3813a1116259 |
---|---|
5435 /* Compute time to wait until, propagating carry from usecs. */ | 5435 /* Compute time to wait until, propagating carry from usecs. */ |
5436 wakeup.tv_usec += 150000; | 5436 wakeup.tv_usec += 150000; |
5437 wakeup.tv_sec += (wakeup.tv_usec / 1000000); | 5437 wakeup.tv_sec += (wakeup.tv_usec / 1000000); |
5438 wakeup.tv_usec %= 1000000; | 5438 wakeup.tv_usec %= 1000000; |
5439 | 5439 |
5440 /* Keep waiting until past the time wakeup. */ | 5440 /* Keep waiting until past the time wakeup or any input gets |
5441 while (1) | 5441 available. */ |
5442 while (! detect_input_pending ()) | |
5442 { | 5443 { |
5444 struct timeval current; | |
5443 struct timeval timeout; | 5445 struct timeval timeout; |
5444 | 5446 |
5445 EMACS_GET_TIME (timeout); | 5447 EMACS_GET_TIME (current); |
5446 | 5448 |
5447 /* In effect, timeout = wakeup - timeout. | 5449 /* Break if result would be negative. */ |
5448 Break if result would be negative. */ | 5450 if (timeval_subtract (¤t, wakeup, current)) |
5449 if (timeval_subtract (&timeout, wakeup, timeout)) | |
5450 break; | 5451 break; |
5452 | |
5453 /* How long `select' should wait. */ | |
5454 timeout.tv_sec = 0; | |
5455 timeout.tv_usec = 10000; | |
5451 | 5456 |
5452 /* Try to wait that long--but we might wake up sooner. */ | 5457 /* Try to wait that long--but we might wake up sooner. */ |
5453 select (0, NULL, NULL, NULL, &timeout); | 5458 select (0, NULL, NULL, NULL, &timeout); |
5454 } | 5459 } |
5455 } | 5460 } |