From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Crowe Newsgroups: gmane.emacs.devel Subject: [PATCH] Re-enable SIGIO when waiting for events Date: Sat, 11 Jul 2015 12:58:00 +0100 Message-ID: <1436615880-1719-1-git-send-email-mac@mcrowe.com> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1436615937 26023 80.91.229.3 (11 Jul 2015 11:58:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Jul 2015 11:58:57 +0000 (UTC) Cc: Mike Crowe To: Emacs Developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 11 13:58:47 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZDtQd-0005C7-Et for ged-emacs-devel@m.gmane.org; Sat, 11 Jul 2015 13:58:47 +0200 Original-Received: from localhost ([::1]:47615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDtQc-00084g-HY for ged-emacs-devel@m.gmane.org; Sat, 11 Jul 2015 07:58:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDtQP-00084Z-Nb for emacs-devel@gnu.org; Sat, 11 Jul 2015 07:58:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDtQM-0004cf-HB for emacs-devel@gnu.org; Sat, 11 Jul 2015 07:58:33 -0400 Original-Received: from smtpout.karoo.kcom.com ([212.50.160.34]:37139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDtQM-0004aw-BL for emacs-devel@gnu.org; Sat, 11 Jul 2015 07:58:30 -0400 X-IronPort-AV: E=Sophos;i="5.15,453,1432594800"; d="scan'208";a="131490328" Original-Received: from deneb.mcrowe.com (HELO deneb) ([82.152.148.4]) by smtpout.karoo.kcom.com with ESMTP; 11 Jul 2015 12:58:21 +0100 Original-Received: from mac by deneb with local (Exim 4.84) (envelope-from ) id 1ZDtQC-0000SP-Ib; Sat, 11 Jul 2015 12:58:20 +0100 X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.50.160.34 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:187802 Archived-At: 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 (); +#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 */ -- 2.1.4