unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Emacs development discussions <emacs-devel@gnu.org>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: Broken timers (handle_alarm_signal is never called)?
Date: Fri, 25 Jul 2014 17:59:44 +0400	[thread overview]
Message-ID: <53D262D0.3020505@yandex.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 676 bytes --]

Can someone explain when handle_alarm_signal is expected to be called?

Executing keyboard macro, say, 100000 times, should enter Emacs into "busy"
state.  Thus hourglass cursor should be displayed, which is done with 1s
delay via start_atimer.  This means that SIGARLM should be (re)scheduled,
and it is.  But handle_alarm_signal is never called; instead, timers are
processed just after the next input becomes available.  So if there is no
input, timers will be processed...never?  If yes, this looks like a very
strange (read: fundamentally broken) timers subsystem.

It should be not so hard to observe this scenario under gdb or with attached
tracing patch.

Dmitry






[-- Attachment #2: timer-trace.patch --]
[-- Type: text/x-patch, Size: 896 bytes --]

=== modified file 'src/atimer.c'
--- src/atimer.c	2014-05-30 04:12:08 +0000
+++ src/atimer.c	2014-07-25 13:53:31 +0000
@@ -292,7 +292,13 @@
 	  ispec.it_value = atimers->expiration;
 	  ispec.it_interval.tv_sec = ispec.it_interval.tv_nsec = 0;
 	  if (timer_settime (alarm_timer, 0, &ispec, 0) == 0)
-	    return;
+	    {
+	      fprintf (stderr, "%f: schedule alarm at %ld:%ld\n",
+		       timespectod (current_timespec ()),
+		       atimers->expiration.tv_sec,
+		       atimers->expiration.tv_nsec);
+	      return;
+	    }
 	}
 #endif
 
@@ -370,6 +376,7 @@
 static void
 handle_alarm_signal (int sig)
 {
+  fprintf (stderr, "%f: got %d\n", timespectod (current_timespec ()), sig);
   pending_signals = 1;
 }
 
@@ -379,6 +386,7 @@
 void
 do_pending_atimers (void)
 {
+  fprintf (stderr, "%f: run timers\n", timespectod (current_timespec ()));
   if (atimers)
     {
       sigset_t oldset;


             reply	other threads:[~2014-07-25 13:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 13:59 Dmitry Antipov [this message]
2014-07-25 14:28 ` Broken timers (handle_alarm_signal is never called)? Eli Zaretskii
2014-07-25 14:43   ` Eli Zaretskii
2014-07-25 15:28   ` Dmitry Antipov
2014-07-25 18:48     ` Eli Zaretskii
2014-07-25 21:54 ` Paul Eggert
2014-07-26  3:42   ` Dmitry Antipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53D262D0.3020505@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).