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: Re: [PATCH] Re-enable SIGIO when waiting for events Date: Wed, 5 Aug 2015 15:28:14 +0100 Message-ID: <20150805142814.GA6222@mcrowe.com> References: <1436615880-1719-1-git-send-email-mac@mcrowe.com> <87fv4n5g05.fsf@linaro.org> <87lhef6uc0.fsf@gnu.org> <55A950C1.8020602@cs.ucla.edu> <20150721124220.GA6160@mcrowe.com> <20150730163155.GA7628@mcrowe.com> <87h9ola3bz.fsf@gnu.org> <877fpghnic.fsf@linaro.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="u3/rZRmxL6MmkK24" Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1438784927 12192 80.91.229.3 (5 Aug 2015 14:28:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Aug 2015 14:28:47 +0000 (UTC) Cc: Alex =?iso-8859-1?Q?Benn=E9e?= To: Emacs Development , Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 05 16:28:38 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 1ZMzgL-00042g-5a for ged-emacs-devel@m.gmane.org; Wed, 05 Aug 2015 16:28:37 +0200 Original-Received: from localhost ([::1]:40719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMzgK-0003XM-Ep for ged-emacs-devel@m.gmane.org; Wed, 05 Aug 2015 10:28:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMzgC-0003QI-0b for Emacs-devel@gnu.org; Wed, 05 Aug 2015 10:28:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMzg6-0000qn-SN for Emacs-devel@gnu.org; Wed, 05 Aug 2015 10:28:27 -0400 Original-Received: from smtpout.karoo.kcom.com ([212.50.160.34]:51341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMzg6-0000ey-HA for Emacs-devel@gnu.org; Wed, 05 Aug 2015 10:28:22 -0400 X-IronPort-AV: E=Sophos;i="5.15,617,1432594800"; d="scan'208,223";a="129608517" Original-Received: from deneb.mcrowe.com (HELO deneb) ([82.152.148.4]) by smtpout.karoo.kcom.com with ESMTP; 05 Aug 2015 15:28:14 +0100 Original-Received: from mac by deneb with local (Exim 4.84) (envelope-from ) id 1ZMzfy-0001y8-6n; Wed, 05 Aug 2015 15:28:14 +0100 Content-Disposition: inline In-Reply-To: <877fpghnic.fsf@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) 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:188443 Archived-At: --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Paul Eggert wrote: >>>>> Thanks for checking. I installed a similar patch as Emacs master >>>>> commit 0592cefd03f1de2f04b721d07a16e6e0a9e48f73; could you please >>>>> give it a try? It is like Mike Crowe's patch, except it avoids a >>>>> race that could lose SIGIOs. I'll also send a heads-up email to the >>>>> relevant bug reports. I wrote: >>> I've been testing with 0592cefd03f1de2f04b721d07a16e6e0a9e48f73 >>> applied to Debian Jessie's emacs24 (24.4+1-5) for over a week now >>> without seeing any problems so I think we can call the bug fixed. On Friday 31 July 2015 at 07:03:39 +0100, Alex Bennée wrote: > Will it get applied to the emacs-24 branch or is that considered dead now? I'm sort of hoping that I can get this fix into a Debian Jessie stable update. It being in upstream emacs-24 would make this more rather more likely. (Debian doesn't allow stuff to be fixed in stable that isn't already fixed in unstable.) Is there any chance of committing the fix to emacs-24? It doesn't cherry-pick cleanly but only requires minor fixing (attached.) Thanks. Mike. --u3/rZRmxL6MmkK24 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-hang-with-large-yanks.patch" >From d47c5b810123c6cbd14dd38ac461aa01a4eabacf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 17 Jul 2015 11:54:24 -0700 Subject: [PATCH] Fix hang with large yanks Backport of emacs-25 0592cefd03f1de2f04b721d07a16e6e0a9e48f73. Upstream comment follows: Fix hang with large yanks This should fix the bug fixed by Mike Crowe's patch in: https://lists.gnu.org/archive/html/emacs-devel/2015-07/msg00106.html A problem in this area has been reported by several users; see Bug#16737, Bug#17101, Bug#17026, Bug#17172, Bug#19320, Bug#20283. This fix differs from Mike Crowe's patch in that it should avoid a race condition that could lose SIGIO signals. ignore_sigio dates back to the 1980s when some platforms couldn't block signals, and could only ignore them, which led to races when signals arrived while being ignored. We shouldn't have to worry about those old platforms now. * src/dispextern.h, src/sysdep.c (ignore_sigio): Remove. * src/emacs.c (shut_down_emacs): Don't call ignore_sigio; unrequest_sigio should suffice. * src/keyboard.c (kbd_buffer_store_buffered_event): Use unrequest_sigio, not ignore_sigio. (kbd_buffer_get_event): Call request_sigio when getting the ball rolling again. Conflicts: src/sysdep.c --- src/dispextern.h | 1 - src/emacs.c | 1 - src/keyboard.c | 4 ++-- src/sysdep.c | 9 --------- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 239c442..cf3d1ec 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3349,7 +3349,6 @@ void unrequest_sigio (void); bool tabs_safe_p (int); void init_baud_rate (int); void init_sigio (int); -void ignore_sigio (void); /* Defined in xfaces.c. */ diff --git a/src/emacs.c b/src/emacs.c index 9b78a70..b5d3ab4 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2028,7 +2028,6 @@ shut_down_emacs (int sig, Lisp_Object stuff) /* There is a tendency for a SIGIO signal to arrive within exit, and cause a SIGHUP because the input descriptor is already closed. */ unrequest_sigio (); - ignore_sigio (); /* Do this only if terminating normally, we want glyph matrices etc. in a core dump. */ diff --git a/src/keyboard.c b/src/keyboard.c index 945019e..77af44a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3663,8 +3663,7 @@ kbd_buffer_store_event_hold (register struct input_event *event, /* Don't read keyboard input until we have processed kbd_buffer. This happens when pasting text longer than KBD_BUFFER_SIZE/2. */ hold_keyboard_input (); - if (!noninteractive) - ignore_sigio (); + unrequest_sigio (); stop_polling (); } #endif /* subprocesses */ @@ -3829,6 +3828,7 @@ 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 (); + request_sigio (); start_polling (); } #endif /* subprocesses */ diff --git a/src/sysdep.c b/src/sysdep.c index 01692c2..4b4801d 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -649,15 +649,6 @@ unrequest_sigio (void) interrupts_deferred = 1; #endif } - -void -ignore_sigio (void) -{ -#ifdef USABLE_SIGIO - signal (SIGIO, SIG_IGN); -#endif -} - /* Saving and restoring the process group of Emacs's terminal. */ -- 2.1.4 --u3/rZRmxL6MmkK24--