summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2004-05-14 20:16:06 +0000
committerKim F. Storm <storm@cua.dk>2004-05-14 20:16:06 +0000
commit9af28288fa636a071149fe67604b0f9691423d0c (patch)
tree74ee2ef0bd72a57f8a21e613cfc7fcdb7046bc9e
parent93589c1fed7e3ad3b0fc5338d0c33500a3fb0915 (diff)
downloademacs-9af28288fa636a071149fe67604b0f9691423d0c.tar.gz
(in_timer_check): New static var.
(timer_check): Use it to guard against reentry.
-rw-r--r--src/keyboard.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index b9e455a4431..a3fae774431 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4249,6 +4249,8 @@ struct input_event last_timer_event;
run the timer directly instead of queueing a timer-event.
Now we always run timers directly. */
+static int in_timer_check = 0;
+
EMACS_TIME
timer_check (do_it_now)
int do_it_now;
@@ -4261,6 +4263,11 @@ timer_check (do_it_now)
EMACS_SET_SECS (nexttime, -1);
EMACS_SET_USECS (nexttime, -1);
+ if (in_timer_check)
+ return nexttime;
+
+ in_timer_check = 1;
+
/* Always consider the ordinary timers. */
timers = Vtimer_list;
/* Consider the idle timers only if Emacs is idle. */
@@ -4419,6 +4426,7 @@ timer_check (do_it_now)
return the amount of time to wait before it is ripe. */
{
UNGCPRO;
+ in_timer_check = 0;
return difference;
}
}
@@ -4426,6 +4434,7 @@ timer_check (do_it_now)
/* No timers are pending in the future. */
/* Return 0 if we generated an event, and -1 if not. */
UNGCPRO;
+ in_timer_check = 0;
return nexttime;
}