emacs-devel
[Top][All Lists]
Advanced

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

Re: alarm_signal_handler is called too frequently


From: YAMAMOTO Mitsuharu
Subject: Re: alarm_signal_handler is called too frequently
Date: Fri, 29 Oct 2004 10:37:40 +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)

>>>>> On Thu, 28 Oct 2004 20:02:13 +0200, "Jan D." <address@hidden> 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
                                address@hidden




reply via email to

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