From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: alarm_signal_handler is called too frequently Date: Fri, 29 Oct 2004 17:24:02 +0900 Organization: Faculty of Science, Chiba University Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: <7E7ABFB6-2693-11D9-9BC4-000D93505B76@swipnet.se> <41813425.2010001@swipnet.se> <4181EA7E.2020309@swipnet.se> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1099038324 4398 80.91.229.6 (29 Oct 2004 08:25:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Oct 2004 08:25:24 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 29 10:25:14 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CNS4P-00046x-00 for ; Fri, 29 Oct 2004 10:25:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CNSCF-00056H-Rw for ged-emacs-devel@m.gmane.org; Fri, 29 Oct 2004 04:33:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CNSBD-0004ui-Jn for emacs-devel@gnu.org; Fri, 29 Oct 2004 04:32:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CNSBC-0004uQ-HI for emacs-devel@gnu.org; Fri, 29 Oct 2004 04:32:14 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CNSBC-0004uK-6j for emacs-devel@gnu.org; Fri, 29 Oct 2004 04:32:14 -0400 Original-Received: from [133.82.132.2] (helo=mathmail.math.s.chiba-u.ac.jp) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CNS3H-0004Vl-Lx; Fri, 29 Oct 2004 04:24:04 -0400 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 6DE861A6383; Fri, 29 Oct 2004 17:24:02 +0900 (JST) Original-To: "Jan D." In-Reply-To: <4181EA7E.2020309@swipnet.se> User-Agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 Emacs/21.3.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 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 Xref: main.gmane.org gmane.emacs.devel:29135 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29135 >>>>> On Fri, 29 Oct 2004 09:00:14 +0200, "Jan D." said: >> That's the reason why I did the following question: >> >> I think we don't have to call set_alarm when pending_atimers is >> non-zero because do_pending_atimers is supposed to be called >> eventually in such a case. Is that correct? > You mean like this? > + if (! (pending_atimers && interrupt_input_blocked)) > set_alarm (); > That works and should save a couple of CPU cycles. I've been using the similar patch in http://lists.gnu.org/archive/html/emacs-devel/2004-10/msg00553.html for two weeks on Solaris/X11 and Mac OS X/Carbon, and it seems to work fine for me. Reduction of CPU cycles is prominent in Mac OS X/Carbon where BLOCK_INPUT is enabled for a long time while waiting for some user input in sys_select (mac.c). We need BLOCK_INPUT (or something like this) here because the only way to know whether input is available or not is to call ReceiveNextEvent, and this function is not reentrant. I think we don't have to poll input with signal while waiting for input. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp