GNU bug report logs - #50043
28.0.50; USABLE_SIGOI undef code paths do not work correctly

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Fri, 13 Aug 2021 11:57:01 UTC

Severity: normal

Found in version 28.0.50

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, 50043 <at> debbugs.gnu.org
Subject: bug#50043: 28.0.50; USABLE_SIGOI undef code paths do not work correctly
Date: Tue, 16 Nov 2021 18:06:51 -0500
On 11/16/2021 12:45 PM, Eli Zaretskii wrote:
>> From: Ken Brown <kbrown <at> cornell.edu>
>>>> We certainly don't want to always skip the select call, but would it make sense
>>>> to use a very short timeout for select in that case?  Or maybe someone has a
>>>> better idea.
>>>
>>> Making timeout shorter might be the solution, but I'd like to
>>> understand the problem better first.
> 
> If the code is based on the premise that we check for selection when
> we exit select, then I think on systems without USABLE_SIGIO we should
> call wait_reading_process_output with a short timeout but in a loop,
> so that the summary wait is still 2 sec, but we exit the loop as soon
> as selection arrives because each call to wait_reading_process_output
> has a much shorter timeout, say, 25 msec.  WDYT?

Are you talking about having x_get_foreign_selection call 
wait_reading_process_output in a loop?  That would fix this particular bug, but 
I was thinking of trying to solve a more general problem.  Namely, whenever 
wait_reading_process_output is polling for input, avoid getting stuck in select, 
something like this:

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

Ken




This bug report was last modified 3 years and 245 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.