comparison src/process.c @ 14458:2bb4652305c1

(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.
author Richard M. Stallman <rms@gnu.org>
date Thu, 01 Feb 1996 20:35:59 +0000
parents 4aa693528ee3
children beca72fdb420
comparison
equal deleted inserted replaced
14457:faef0869994d 14458:2bb4652305c1
2024 EMACS_ADD_TIME (end_time, end_time, timeout); 2024 EMACS_ADD_TIME (end_time, end_time, timeout);
2025 } 2025 }
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. */
2032 if (XINT (read_kbd) >= 0) 2034 if (XINT (read_kbd) >= 0)
2033 QUIT; 2035 QUIT;
2062 run timer events directly. 2064 run timer events directly.
2063 (Callers that will immediately read keyboard events 2065 (Callers that will immediately read keyboard events
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
2077 /* Cause C-g and alarm signals to take immediate action, 2083 /* Cause C-g and alarm signals to take immediate action,
2078 and cause input available signals to zero out timeout. 2084 and cause input available signals to zero out timeout.
2147 clear_waiting_for_input (); 2153 clear_waiting_for_input ();
2148 2154
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 {
2156 if (xerrno == EINTR) 2163 if (xerrno == EINTR)
2157 FD_ZERO (&Available); 2164 FD_ZERO (&Available);