aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-12-23 14:06:41 -0500
committerLiam <byteslice@airmail.cc>2023-12-23 15:36:46 -0500
commit468ef514f10aa7b865e4aeed2dfc520024f0ff26 (patch)
tree6663a52529852ca1279b7461807e3beb8ed312af /src/core
parentb9545c5a0e514df861937340a3c5b2be75882201 (diff)
core_timing: use static typing for no-wait unschedule
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core_timing.cpp5
-rw-r--r--src/core/core_timing.h12
-rw-r--r--src/core/hle/kernel/k_hardware_timer.cpp3
3 files changed, 12 insertions, 8 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 3b7b0aa45f..d08c007bbe 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -143,7 +143,8 @@ void CoreTiming::ScheduleLoopingEvent(std::chrono::nanoseconds start_time,
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};
@@ -161,7 +162,7 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, b
}
// Force any in-progress events to finish
- if (wait) {
+ if (type == UnscheduleEventType::Wait) {
std::scoped_lock lk{advance_lock};
}
}
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index d86337cdc9..d8cd599ee7 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -35,6 +35,11 @@ struct EventType {
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
* in main CPU clock cycles.
@@ -98,11 +103,8 @@ public:
const std::shared_ptr<EventType>& event_type,
bool absolute_time = false);
- void UnscheduleEvent(const std::shared_ptr<EventType>& event_type, bool wait = true);
-
- void UnscheduleEventWithoutWait(const std::shared_ptr<EventType>& event_type) {
- UnscheduleEvent(event_type, false);
- }
+ void UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
+ UnscheduleEventType type = UnscheduleEventType::Wait);
void AddTicks(u64 ticks_to_add);
diff --git a/src/core/hle/kernel/k_hardware_timer.cpp b/src/core/hle/kernel/k_hardware_timer.cpp
index 2a29a487c1..4e947dd6bc 100644
--- a/src/core/hle/kernel/k_hardware_timer.cpp
+++ b/src/core/hle/kernel/k_hardware_timer.cpp
@@ -61,7 +61,8 @@ void KHardwareTimer::EnableInterrupt(s64 wakeup_time) {
}
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();
}