unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Broken timers (handle_alarm_signal is never called)?
@ 2014-07-25 13:59 Dmitry Antipov
  2014-07-25 14:28 ` Eli Zaretskii
  2014-07-25 21:54 ` Paul Eggert
  0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Antipov @ 2014-07-25 13:59 UTC (permalink / raw)
  To: Emacs development discussions; +Cc: Paul Eggert

[-- 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;


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-26  3:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-25 13:59 Broken timers (handle_alarm_signal is never called)? Dmitry Antipov
2014-07-25 14:28 ` 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

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).