timer.c: timers get rescheduled only if enable state has changed [Christophe Jaillet]

This commit is contained in:
Fabio Priuli 2010-09-01 10:13:45 +00:00
parent dbf7afe106
commit 4c0b712c8e

View File

@ -759,15 +759,18 @@ void timer_reset(emu_timer *which, attotime duration)
int timer_enable(emu_timer *which, int enable) int timer_enable(emu_timer *which, int enable)
{ {
int old; int old = which->enabled;
/* reschedule only if the state has changed */
if (old != enable)
{
/* set the enable flag */ /* set the enable flag */
old = which->enabled;
which->enabled = enable; which->enabled = enable;
/* remove the timer and insert back into the list */ /* remove the timer and insert back into the list */
timer_list_remove(which); timer_list_remove(which);
timer_list_insert(which); timer_list_insert(which);
}
return old; return old;
} }