mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-24 09:20:58 +01:00
core_timing: use static typing for no-wait unschedule
This commit is contained in:
parent
f34d3d7e84
commit
575db04172
3 changed files with 12 additions and 8 deletions
|
@ -143,7 +143,8 @@ void CoreTiming::ScheduleLoopingEvent(std::chrono::nanoseconds start_time,
|
||||||
event.Set();
|
event.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, bool wait) {
|
void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
|
||||||
|
UnscheduleEventType type) {
|
||||||
{
|
{
|
||||||
std::scoped_lock lk{basic_lock};
|
std::scoped_lock lk{basic_lock};
|
||||||
|
|
||||||
|
@ -161,7 +162,7 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force any in-progress events to finish
|
// Force any in-progress events to finish
|
||||||
if (wait) {
|
if (type == UnscheduleEventType::Wait) {
|
||||||
std::scoped_lock lk{advance_lock};
|
std::scoped_lock lk{advance_lock};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,11 @@ struct EventType {
|
||||||
const std::string name;
|
const std::string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class UnscheduleEventType {
|
||||||
|
Wait,
|
||||||
|
NoWait,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a system to schedule events into the emulated machine's future. Time is measured
|
* This is a system to schedule events into the emulated machine's future. Time is measured
|
||||||
* in main CPU clock cycles.
|
* in main CPU clock cycles.
|
||||||
|
@ -98,11 +103,8 @@ public:
|
||||||
const std::shared_ptr<EventType>& event_type,
|
const std::shared_ptr<EventType>& event_type,
|
||||||
bool absolute_time = false);
|
bool absolute_time = false);
|
||||||
|
|
||||||
void UnscheduleEvent(const std::shared_ptr<EventType>& event_type, bool wait = true);
|
void UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
|
||||||
|
UnscheduleEventType type = UnscheduleEventType::Wait);
|
||||||
void UnscheduleEventWithoutWait(const std::shared_ptr<EventType>& event_type) {
|
|
||||||
UnscheduleEvent(event_type, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddTicks(u64 ticks_to_add);
|
void AddTicks(u64 ticks_to_add);
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,8 @@ void KHardwareTimer::EnableInterrupt(s64 wakeup_time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void KHardwareTimer::DisableInterrupt() {
|
void KHardwareTimer::DisableInterrupt() {
|
||||||
m_kernel.System().CoreTiming().UnscheduleEventWithoutWait(m_event_type);
|
m_kernel.System().CoreTiming().UnscheduleEvent(m_event_type,
|
||||||
|
Core::Timing::UnscheduleEventType::NoWait);
|
||||||
m_wakeup_time = std::numeric_limits<s64>::max();
|
m_wakeup_time = std::numeric_limits<s64>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue