[Top][All Lists]

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

alarm_signal_handler is called too frequently

From: YAMAMOTO Mitsuharu
Subject: alarm_signal_handler is called too frequently
Date: Wed, 13 Oct 2004 10:15:53 +0900
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)

I noticed that alarm_signal_handler was called too frequently on the
system that used polling with SIGALRM (such as Solaris/X11 and Mac OS
X/Carbon).  In alarm_signal_handler, set_alarm is called even when
interrupt_input_blocked is non-zero where no timer function is
executed.  If BLOCK_INPUT continues for a long time, which is typical
in Mac OS X/Carbon, set_alarm will set the timer value to 1000 usec
because the current time (now) exceeds the old expiration time
(atimers->expiration).  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?

The following patch also apparently reduces the CPU usage during the
idle time (~1.0% -> 0.0% on my PowerBook G4 667MHz).

                                     YAMAMOTO Mitsuharu

Index: src/atimer.c
RCS file: /cvsroot/emacs/emacs/src/atimer.c,v
retrieving revision 1.16
diff -c -r1.16 atimer.c
*** src/atimer.c        19 Jul 2004 04:42:43 -0000      1.16
--- src/atimer.c        13 Oct 2004 00:56:47 -0000
*** 397,403 ****
        EMACS_GET_TIME (now);
!   set_alarm ();
--- 397,404 ----
        EMACS_GET_TIME (now);
!   if (!pending_atimers)
!     set_alarm ();

reply via email to

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