mirror of
https://github.com/holub/mame
synced 2025-05-23 06:08:48 +03:00
timer.c: timers get rescheduled only if enable state has changed [Christophe Jaillet]
This commit is contained in:
parent
dbf7afe106
commit
4c0b712c8e
@ -759,15 +759,18 @@ void timer_reset(emu_timer *which, attotime duration)
|
||||
|
||||
int timer_enable(emu_timer *which, int enable)
|
||||
{
|
||||
int old;
|
||||
int old = which->enabled;
|
||||
|
||||
/* set the enable flag */
|
||||
old = which->enabled;
|
||||
which->enabled = enable;
|
||||
/* reschedule only if the state has changed */
|
||||
if (old != enable)
|
||||
{
|
||||
/* set the enable flag */
|
||||
which->enabled = enable;
|
||||
|
||||
/* remove the timer and insert back into the list */
|
||||
timer_list_remove(which);
|
||||
timer_list_insert(which);
|
||||
/* remove the timer and insert back into the list */
|
||||
timer_list_remove(which);
|
||||
timer_list_insert(which);
|
||||
}
|
||||
|
||||
return old;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user