[Top][All Lists]

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

[PATCH] Re-enable SIGIO when waiting for events

From: Mike Crowe
Subject: [PATCH] Re-enable SIGIO when waiting for events
Date: Sat, 11 Jul 2015 12:58:00 +0100

Pasting a large string into an Emacs tty frame causes
keyboard.c:kbd_buffer_store_buffered_event to call ignore_sigio()
which sets SIGIO to SIG_IGN.

Unfortunately no-one seems to ever re-enable the SIGIO handler.

This leads to timeouts when attempting to paste into an Emacs X11
frame as reported at
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16737 .

It appears that keyboard.c:kbd_buffer_get_event used to re-enable the
signal handler but that was removed as part of a large signal-handling
clean up in 4d7e6e51dd4acecff466a28d958c50f34fc130b8.

Reinstating the re-enabling of SIGIO in kbd_buffer_get_event solves
the problems reported in bug 16737 for me.

* src/keyboard.c (kbd_buffer_get_event): Re-enable SIGIO when waiting
  for event.
 src/keyboard.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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 ();
+      if (!noninteractive)
+       {
+         struct sigaction action;
+         emacs_sigaction_init (&action, deliver_input_available_signal);
+         sigaction (SIGIO, &action, 0);
+       }
       start_polling ();
 #endif /* subprocesses */

reply via email to

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