diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/core_timing.cpp | 5 | ||||
| -rw-r--r-- | src/core/core_timing.h | 12 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_hardware_timer.cpp | 3 |
3 files changed, 12 insertions, 8 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 3b7b0aa45..d08c007bb 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, | |||
| 143 | event.Set(); | 143 | event.Set(); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, bool wait) { | 146 | void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, |
| 147 | UnscheduleEventType type) { | ||
| 147 | { | 148 | { |
| 148 | std::scoped_lock lk{basic_lock}; | 149 | std::scoped_lock lk{basic_lock}; |
| 149 | 150 | ||
| @@ -161,7 +162,7 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, b | |||
| 161 | } | 162 | } |
| 162 | 163 | ||
| 163 | // Force any in-progress events to finish | 164 | // Force any in-progress events to finish |
| 164 | if (wait) { | 165 | if (type == UnscheduleEventType::Wait) { |
| 165 | std::scoped_lock lk{advance_lock}; | 166 | std::scoped_lock lk{advance_lock}; |
| 166 | } | 167 | } |
| 167 | } | 168 | } |
diff --git a/src/core/core_timing.h b/src/core/core_timing.h index d86337cdc..d8cd599ee 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h | |||
| @@ -35,6 +35,11 @@ struct EventType { | |||
| 35 | const std::string name; | 35 | const std::string name; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | enum class UnscheduleEventType { | ||
| 39 | Wait, | ||
| 40 | NoWait, | ||
| 41 | }; | ||
| 42 | |||
| 38 | /** | 43 | /** |
| 39 | * This is a system to schedule events into the emulated machine's future. Time is measured | 44 | * This is a system to schedule events into the emulated machine's future. Time is measured |
| 40 | * in main CPU clock cycles. | 45 | * in main CPU clock cycles. |
| @@ -98,11 +103,8 @@ public: | |||
| 98 | const std::shared_ptr<EventType>& event_type, | 103 | const std::shared_ptr<EventType>& event_type, |
| 99 | bool absolute_time = false); | 104 | bool absolute_time = false); |
| 100 | 105 | ||
| 101 | void UnscheduleEvent(const std::shared_ptr<EventType>& event_type, bool wait = true); | 106 | void UnscheduleEvent(const std::shared_ptr<EventType>& event_type, |
| 102 | 107 | UnscheduleEventType type = UnscheduleEventType::Wait); | |
| 103 | void UnscheduleEventWithoutWait(const std::shared_ptr<EventType>& event_type) { | ||
| 104 | UnscheduleEvent(event_type, false); | ||
| 105 | } | ||
| 106 | 108 | ||
| 107 | void AddTicks(u64 ticks_to_add); | 109 | void AddTicks(u64 ticks_to_add); |
| 108 | 110 | ||
diff --git a/src/core/hle/kernel/k_hardware_timer.cpp b/src/core/hle/kernel/k_hardware_timer.cpp index 2a29a487c..4e947dd6b 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) { | |||
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | void KHardwareTimer::DisableInterrupt() { | 63 | void KHardwareTimer::DisableInterrupt() { |
| 64 | m_kernel.System().CoreTiming().UnscheduleEventWithoutWait(m_event_type); | 64 | m_kernel.System().CoreTiming().UnscheduleEvent(m_event_type, |
| 65 | Core::Timing::UnscheduleEventType::NoWait); | ||
| 65 | m_wakeup_time = std::numeric_limits<s64>::max(); | 66 | m_wakeup_time = std::numeric_limits<s64>::max(); |
| 66 | } | 67 | } |
| 67 | 68 | ||