emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5896ca8: Avoid delays waiting for input on systems without SIGIO


From: Ken Brown
Subject: master 5896ca8: Avoid delays waiting for input on systems without SIGIO
Date: Wed, 17 Nov 2021 12:48:52 -0500 (EST)

branch: master
commit 5896ca8925b65d86a392269c0696c96755890b1a
Author: Ken Brown <kbrown@cornell.edu>
Commit: Ken Brown <kbrown@cornell.edu>

    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)
---
 src/process.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/process.c b/src/process.c
index f923aff..808bf6f 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,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]