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 10:37:40 +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> 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 1099013908 21248 80.91.229.6 (29 Oct 2004 01:38:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Oct 2004 01:38:28 +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 03:38:17 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 1CNLib-0001QH-00 for ; Fri, 29 Oct 2004 03:38:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CNLqQ-0007uh-9F for ged-emacs-devel@m.gmane.org; Thu, 28 Oct 2004 21:46:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CNLqH-0007uc-V9 for emacs-devel@gnu.org; Thu, 28 Oct 2004 21:46:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CNLqH-0007uQ-IQ for emacs-devel@gnu.org; Thu, 28 Oct 2004 21:46:13 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CNLqH-0007uN-G5 for emacs-devel@gnu.org; Thu, 28 Oct 2004 21:46:13 -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 1CNLi4-0005zU-RW; Thu, 28 Oct 2004 21:37:45 -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 CBFB51A6395; Fri, 29 Oct 2004 10:37:40 +0900 (JST) Original-To: "Jan D." In-Reply-To: <41813425.2010001@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:29126 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29126 >>>>> On Thu, 28 Oct 2004 20:02:13 +0200, "Jan D." said: > Timers are running (scheduled), The version that uses Xt has a timer > that runs every 0.1 seconds, and I also have a blinking cursor. There may be some confusion between two kinds of timers: the OS-level alarm timer and the Emacs-level (cooperative?) timer. The timer for Xt timeout events is the former, and the cursor blinking uses the latter. The function timer_check is also for the latter. > The reason no timers are actualy run is this code in > alarm_signal_handler in atimer.c: > > while (atimers > && (pending_atimers = interrupt_input_blocked) == 0 > && EMACS_TIME_LE (atimers->expiration, now)) > ... > The above code is about the OS-level timer, which I was concerning about in my original message. > Since popups are within BLOCK/UNBLOCK__INPUT, the signal handler > just reschedules the alarm without running any timer code. Actually, the signal handler only sets the interval timer value (set_alarm) without calling schedule_atimer in this situation. The new interval may become a small value, 1msec, by the following code in set_alarm. /* Don't set the interval to 0; this disables the timer. */ if (EMACS_TIME_LE (atimers->expiration, now)) { EMACS_SET_SECS (time, 0); EMACS_SET_USECS (time, 1000); } bzero (&it, sizeof it); it.it_value = time; setitimer (ITIMER_REAL, &it, 0); 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? YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp