bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#16737: Possible patch


From: Mike Crowe
Subject: bug#16737: Possible patch
Date: Thu, 9 Jul 2015 13:44:15 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Wednesday 08 July 2015 at 21:54:13 +0100, Mike Crowe wrote:
> Thanks to Alan's reproduction recipe in message #158 I've been able to
> do a bit of digging.
> 
> From what I can determine pselect is continuously being woken up due
> to activity on the X file descriptor (this can be seen in message #70)
> yet pending_signals never gets set so unblock_input_to never calls
> process_pending_signals so xgselect just goes round and round until
> the timeout time is reached. :(
> 
> I suspected that SIGIO was left being incorrectly blocked but I
> haven't been able to find any evidence for that yet.

I think that suspicion is correct.

The massive paste in the terminal causes
keyboard.c:kbd_buffer_store_buffered_event to call ignore_sigio() but the only
place I could find that sets the handler for SIGIO is init_keyboard so
noone ever re-enables the SIGIO signal handler. :(

It appears that keyboard.c:kbd_buffer_get_event used to re-enable the
signal handler but that was removed in
4d7e6e51dd4acecff466a28d958c50f34fc130b8.

I tried reinstating enabling the signal handler with this patch
against master and I can no longer reproduce the problem when
following with Alan's recipe.

I've no idea whether this is the correct fix though.

commit eb28ee70c836cc273dcca4c5c3de1099db2cd4fe
Author: Mike Crowe <address@hidden>
Date:   Thu Jul 9 13:32:55 2015 +0100

    Fix 16737

diff --git a/src/keyboard.c b/src/keyboard.c
index c5a392f..e710d5a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -316,6 +316,8 @@ static Lisp_Object command_loop (void);
 static void echo_now (void);
 static ptrdiff_t echo_length (void);
 
+static void deliver_input_available_signal (int sig);
+
 /* Incremented whenever a timer is run.  */
 unsigned timers_run;
 
@@ -3849,6 +3851,14 @@ kbd_buffer_get_event (KBOARD **kbp,
       /* Start reading input again because we have processed enough to
          be able to accept new events again.  */
       unhold_keyboard_input ();
+#ifdef USABLE_SIGIO
+      if (!noninteractive)
+       {
+         struct sigaction action;
+         emacs_sigaction_init (&action, deliver_input_available_signal);
+         sigaction (SIGIO, &action, 0);
+       }
+#endif
       start_polling ();
     }
 #endif /* subprocesses */


Mike.





reply via email to

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