comparison src/keyboard.c @ 55596:0249aeeeaad6

(in_timer_check): New static var. (timer_check): Use it to guard against reentry.
author Kim F. Storm <storm@cua.dk>
date Fri, 14 May 2004 20:16:06 +0000
parents a71808c780ee
children 2f83cdfb90f6
comparison
equal deleted inserted replaced
55595:9462ee156651 55596:0249aeeeaad6
4247 4247
4248 DO_IT_NOW is now ignored. It used to mean that we should 4248 DO_IT_NOW is now ignored. It used to mean that we should
4249 run the timer directly instead of queueing a timer-event. 4249 run the timer directly instead of queueing a timer-event.
4250 Now we always run timers directly. */ 4250 Now we always run timers directly. */
4251 4251
4252 static int in_timer_check = 0;
4253
4252 EMACS_TIME 4254 EMACS_TIME
4253 timer_check (do_it_now) 4255 timer_check (do_it_now)
4254 int do_it_now; 4256 int do_it_now;
4255 { 4257 {
4256 EMACS_TIME nexttime; 4258 EMACS_TIME nexttime;
4258 Lisp_Object timers, idle_timers, chosen_timer; 4260 Lisp_Object timers, idle_timers, chosen_timer;
4259 struct gcpro gcpro1, gcpro2, gcpro3; 4261 struct gcpro gcpro1, gcpro2, gcpro3;
4260 4262
4261 EMACS_SET_SECS (nexttime, -1); 4263 EMACS_SET_SECS (nexttime, -1);
4262 EMACS_SET_USECS (nexttime, -1); 4264 EMACS_SET_USECS (nexttime, -1);
4265
4266 if (in_timer_check)
4267 return nexttime;
4268
4269 in_timer_check = 1;
4263 4270
4264 /* Always consider the ordinary timers. */ 4271 /* Always consider the ordinary timers. */
4265 timers = Vtimer_list; 4272 timers = Vtimer_list;
4266 /* Consider the idle timers only if Emacs is idle. */ 4273 /* Consider the idle timers only if Emacs is idle. */
4267 if (! EMACS_TIME_NEG_P (timer_idleness_start_time)) 4274 if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
4417 else 4424 else
4418 /* When we encounter a timer that is still waiting, 4425 /* When we encounter a timer that is still waiting,
4419 return the amount of time to wait before it is ripe. */ 4426 return the amount of time to wait before it is ripe. */
4420 { 4427 {
4421 UNGCPRO; 4428 UNGCPRO;
4429 in_timer_check = 0;
4422 return difference; 4430 return difference;
4423 } 4431 }
4424 } 4432 }
4425 4433
4426 /* No timers are pending in the future. */ 4434 /* No timers are pending in the future. */
4427 /* Return 0 if we generated an event, and -1 if not. */ 4435 /* Return 0 if we generated an event, and -1 if not. */
4428 UNGCPRO; 4436 UNGCPRO;
4437 in_timer_check = 0;
4429 return nexttime; 4438 return nexttime;
4430 } 4439 }
4431 4440
4432 /* Caches for modify_event_symbol. */ 4441 /* Caches for modify_event_symbol. */
4433 static Lisp_Object accent_key_syms; 4442 static Lisp_Object accent_key_syms;