瀏覽代碼

CoreTiming/CycleTimer: Correct Idling.

Fernando Sahmkow 6 年之前
父節點
當前提交
bfb5244cf8
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/core/core_timing.cpp

+ 5 - 2
src/core/core_timing.cpp

@@ -136,8 +136,11 @@ void CoreTiming::AddTicks(u64 ticks) {
 
 void CoreTiming::Idle() {
     if (!event_queue.empty()) {
-        u64 next_event_time = event_queue.front().time;
-        ticks = nsToCycles(std::chrono::nanoseconds(next_event_time)) + 10U;
+        const u64 next_event_time = event_queue.front().time;
+        const u64 next_ticks = nsToCycles(std::chrono::nanoseconds(next_event_time)) + 10U;
+        if (next_ticks > ticks) {
+            ticks = next_ticks;
+        }
         return;
     }
     ticks += 1000U;