diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index f6555166af..2f3948f6e7 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -527,7 +527,7 @@ namespace rsx fesetround(FE_TONEAREST); // TODO: exit condition - while (!Emu.IsStopped()) + while (true) { // Wait for external pause events if (external_interrupt_lock.load()) @@ -536,13 +536,6 @@ namespace rsx while (external_interrupt_lock.load()) _mm_pause(); } - // Idle if emulation paused - if (Emu.IsPaused()) - { - std::this_thread::sleep_for(1ms); - continue; - } - // Note a possible rollback address if (sync_point_request) { @@ -559,6 +552,20 @@ namespace rsx // Execute FIFO queue run_FIFO(); + + if (!Emu.IsRunning()) + { + // Idle if emulation paused + while (Emu.IsPaused()) + { + std::this_thread::sleep_for(1ms); + } + + if (Emu.IsStopped()) + { + break; + } + } } } @@ -900,12 +907,14 @@ namespace rsx if (!in_begin_end && state != FIFO_state::lock_wait) { - reader_lock lock(m_mtx_task); - - if (m_invalidated_memory_range.valid()) + if (atomic_storage::load(m_invalidated_memory_range.end) != 0) { - lock.upgrade(); - handle_invalidated_memory_range(); + std::lock_guard lock(m_mtx_task); + + if (m_invalidated_memory_range.valid()) + { + handle_invalidated_memory_range(); + } } } }