From: Ken Brown <kbrown@cornell.edu> Date: Wed, 17 Nov 2021 16:55:39 +0000 (-0500) Subject: Avoid delays waiting for input on systems without SIGIO X-Git-Tag: emacs-29.0.90~2852^2~228 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5896ca8925b65d86a392269c0696c96755890b1a;p=emacs.git Avoid delays waiting for input on systems without SIGIO * src/process.c (wait_reading_process_output) [!USABLE_SIGIO]: If we're waiting for input, don't use a timeout of more than 25 msec in the call to select. (Bug#50043) --- diff --git a/src/process.c b/src/process.c index f923aff1cb3..808bf6f1ff9 100644 --- a/src/process.c +++ b/src/process.c @@ -5588,6 +5588,15 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, timeout = make_timespec (0, 0); #endif +#ifndef USABLE_SIGIO + /* If we're polling for input, don't get stuck in select for + more than 25 msec. */ + struct timespec short_timeout = make_timespec (0, 25000000); + if ((read_kbd || !NILP (wait_for_cell)) + && timespec_cmp (short_timeout, timeout) < 0) + timeout = short_timeout; +#endif + /* Non-macOS HAVE_GLIB builds call thread_select in xgselect.c. */ #if defined HAVE_GLIB && !defined HAVE_NS nfds = xg_select (max_desc + 1,