From 4c0b712c8ee0f5acb272aafda8221b8fdc89227b Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Wed, 1 Sep 2010 10:13:45 +0000 Subject: [PATCH] timer.c: timers get rescheduled only if enable state has changed [Christophe Jaillet] --- src/emu/timer.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/emu/timer.c b/src/emu/timer.c index 709351a83c1..aadeb4f6a47 100644 --- a/src/emu/timer.c +++ b/src/emu/timer.c @@ -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; }