diff options
| author | Richard M. Stallman | 1996-02-01 20:35:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-02-01 20:35:59 +0000 |
| commit | c0239a0b8b5efaa5b0666e778f61f5cd402c0526 (patch) | |
| tree | e095a3286ace984a8fc9ed7e53da6682e438288c /src/process.c | |
| parent | 0468655b6550884376223752efe2ed3ebd2e7648 (diff) | |
| download | emacs-c0239a0b8b5efaa5b0666e778f61f5cd402c0526.tar.gz emacs-c0239a0b8b5efaa5b0666e778f61f5cd402c0526.zip | |
(wait_reading_process_input): If select times out,
return only if we had no timers to shorten the wait.
Don't shorten the wait for timers if time_limit is -1.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/process.c b/src/process.c index 59bcd8cb11d..7af4115de6f 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2026,6 +2026,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 2026 | 2026 | ||
| 2027 | while (1) | 2027 | while (1) |
| 2028 | { | 2028 | { |
| 2029 | int timeout_reduced_for_timers = 0; | ||
| 2030 | |||
| 2029 | /* If calling from keyboard input, do not quit | 2031 | /* If calling from keyboard input, do not quit |
| 2030 | since we want to return C-g as an input character. | 2032 | since we want to return C-g as an input character. |
| 2031 | Otherwise, do pending quit if requested. */ | 2033 | Otherwise, do pending quit if requested. */ |
| @@ -2064,13 +2066,17 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 2064 | call timer_delay on their own.) */ | 2066 | call timer_delay on their own.) */ |
| 2065 | if (read_kbd >= 0) | 2067 | if (read_kbd >= 0) |
| 2066 | { | 2068 | { |
| 2067 | EMACS_TIME timer_delay = timer_check (1); | 2069 | EMACS_TIME timer_delay; |
| 2068 | if (! EMACS_TIME_NEG_P (timer_delay)) | 2070 | timer_delay = timer_check (1); |
| 2071 | if (! EMACS_TIME_NEG_P (timer_delay) && time_limit != -1) | ||
| 2069 | { | 2072 | { |
| 2070 | EMACS_TIME difference; | 2073 | EMACS_TIME difference; |
| 2071 | EMACS_SUB_TIME (difference, timer_delay, timeout); | 2074 | EMACS_SUB_TIME (difference, timer_delay, timeout); |
| 2072 | if (EMACS_TIME_NEG_P (difference)) | 2075 | if (EMACS_TIME_NEG_P (difference)) |
| 2073 | timeout = timer_delay; | 2076 | { |
| 2077 | timeout = timer_delay; | ||
| 2078 | timeout_reduced_for_timers = 1; | ||
| 2079 | } | ||
| 2074 | } | 2080 | } |
| 2075 | } | 2081 | } |
| 2076 | 2082 | ||
| @@ -2149,7 +2155,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 2149 | /* If we woke up due to SIGWINCH, actually change size now. */ | 2155 | /* If we woke up due to SIGWINCH, actually change size now. */ |
| 2150 | do_pending_window_change (); | 2156 | do_pending_window_change (); |
| 2151 | 2157 | ||
| 2152 | if (time_limit && nfds == 0) /* timeout elapsed */ | 2158 | if (time_limit && nfds == 0 && ! timeout_reduced_for_timers) |
| 2159 | /* We wanted the full specified time, so return now. */ | ||
| 2153 | break; | 2160 | break; |
| 2154 | if (nfds < 0) | 2161 | if (nfds < 0) |
| 2155 | { | 2162 | { |