From 0f40df67a8a18972babe5ae418e861bca4d19f1c Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 4 Jun 2022 18:40:14 +1000 Subject: emu/schedule.cpp: Reduced spam from use of synchronize() - it serves a purpose for now. --- src/emu/schedule.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/emu/schedule.cpp') diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index ef3961c84f4..cc69a542914 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -72,13 +72,13 @@ emu_timer::~emu_timer() // re-allocated as a non-device timer //------------------------------------------------- -inline emu_timer &emu_timer::init(running_machine &machine, timer_expired_delegate callback, bool temporary) +emu_timer &emu_timer::init(running_machine &machine, timer_expired_delegate &&callback, bool temporary) { // ensure the entire timer state is clean m_machine = &machine; m_next = nullptr; m_prev = nullptr; - m_callback = callback; + m_callback = std::move(callback); m_param = 0; m_enabled = false; m_temporary = temporary; @@ -501,14 +501,17 @@ void device_scheduler::trigger(int trigid, const attotime &after) if (m_execute_list == nullptr) rebuild_execute_list(); - // if we have a non-zero time, schedule a timer if (after != attotime::zero) + { + // if we have a non-zero time, schedule a timer timer_set(after, timer_expired_delegate(FUNC(device_scheduler::timed_trigger), this), trigid); - - // send the trigger to everyone who cares + } else - for (device_execute_interface *exec = m_execute_list; exec != nullptr; exec = exec->m_nextexec) + { + // send the trigger to everyone who cares + for (device_execute_interface *exec = m_execute_list; exec; exec = exec->m_nextexec) exec->trigger(trigid); + } } @@ -533,7 +536,7 @@ void device_scheduler::boost_interleave(const attotime ×lice_time, const at emu_timer *device_scheduler::timer_alloc(timer_expired_delegate callback) { - return &m_timer_allocator.alloc()->init(machine(), callback, false); + return &m_timer_allocator.alloc()->init(machine(), std::move(callback), false); } @@ -545,7 +548,7 @@ emu_timer *device_scheduler::timer_alloc(timer_expired_delegate callback) void device_scheduler::timer_set(const attotime &duration, timer_expired_delegate callback, int param) { - m_timer_allocator.alloc()->init(machine(), callback, true).adjust(duration, param); + m_timer_allocator.alloc()->init(machine(), std::move(callback), true).adjust(duration, param); } -- cgit v1.2.3-70-g09d2