mirror of
https://github.com/holub/mame
synced 2025-06-08 13:53:52 +03:00
emu/schedule.cpp: Reduced spam from use of synchronize() - it serves a purpose for now.
This commit is contained in:
parent
c93195e72f
commit
0f40df67a8
@ -72,13 +72,13 @@ emu_timer::~emu_timer()
|
|||||||
// re-allocated as a non-device 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
|
// ensure the entire timer state is clean
|
||||||
m_machine = &machine;
|
m_machine = &machine;
|
||||||
m_next = nullptr;
|
m_next = nullptr;
|
||||||
m_prev = nullptr;
|
m_prev = nullptr;
|
||||||
m_callback = callback;
|
m_callback = std::move(callback);
|
||||||
m_param = 0;
|
m_param = 0;
|
||||||
m_enabled = false;
|
m_enabled = false;
|
||||||
m_temporary = temporary;
|
m_temporary = temporary;
|
||||||
@ -501,14 +501,17 @@ void device_scheduler::trigger(int trigid, const attotime &after)
|
|||||||
if (m_execute_list == nullptr)
|
if (m_execute_list == nullptr)
|
||||||
rebuild_execute_list();
|
rebuild_execute_list();
|
||||||
|
|
||||||
// if we have a non-zero time, schedule a timer
|
|
||||||
if (after != attotime::zero)
|
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);
|
timer_set(after, timer_expired_delegate(FUNC(device_scheduler::timed_trigger), this), trigid);
|
||||||
|
}
|
||||||
// send the trigger to everyone who cares
|
|
||||||
else
|
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);
|
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)
|
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)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class emu_timer
|
|||||||
~emu_timer();
|
~emu_timer();
|
||||||
|
|
||||||
// allocation and re-use
|
// allocation and re-use
|
||||||
emu_timer &init(running_machine &machine, timer_expired_delegate callback, bool temporary);
|
emu_timer &init(running_machine &machine, timer_expired_delegate &&callback, bool temporary) ATTR_HOT;
|
||||||
emu_timer &release();
|
emu_timer &release();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -120,7 +120,8 @@ public:
|
|||||||
emu_timer *timer_alloc(timer_expired_delegate callback);
|
emu_timer *timer_alloc(timer_expired_delegate callback);
|
||||||
[[deprecated("timer_set is deprecated; please avoid anonymous timers. Use TIMER_CALLBACK_MEMBER and an allocated emu_timer instead.")]]
|
[[deprecated("timer_set is deprecated; please avoid anonymous timers. Use TIMER_CALLBACK_MEMBER and an allocated emu_timer instead.")]]
|
||||||
void timer_set(const attotime &duration, timer_expired_delegate callback, int param = 0);
|
void timer_set(const attotime &duration, timer_expired_delegate callback, int param = 0);
|
||||||
void synchronize(timer_expired_delegate callback = timer_expired_delegate(), int param = 0) { timer_set(attotime::zero, callback, param); }
|
void synchronize(timer_expired_delegate callback = timer_expired_delegate(), int param = 0)
|
||||||
|
{ m_timer_allocator.alloc()->init(machine(), std::move(callback), true).adjust(attotime::zero, param); }
|
||||||
|
|
||||||
// debugging
|
// debugging
|
||||||
void dump_timers() const;
|
void dump_timers() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user