]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid delays waiting for input on systems without SIGIO
authorKen Brown <kbrown@cornell.edu>
Wed, 17 Nov 2021 16:55:39 +0000 (11:55 -0500)
committerKen Brown <kbrown@cornell.edu>
Wed, 17 Nov 2021 16:56:14 +0000 (11:56 -0500)
* 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)

src/process.c

index f923aff1cb3d110a8f60426a4da94915281e0638..808bf6f1ff9132cfc41c3c12377d7cf452e3d63a 100644 (file)
@@ -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,