From 0bb3609cad32be12445ee79685314b454c1d6d90 Mon Sep 17 00:00:00 2001 From: Eladash Date: Thu, 22 Oct 2020 19:05:54 +0300 Subject: [PATCH] Debugger: Simplify thread pause state change --- rpcs3/rpcs3qt/debugger_frame.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 09c71ff6d5..c1ff72e645 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -136,16 +136,13 @@ debugger_frame::debugger_frame(std::shared_ptr settings, QWidget * { if (const auto cpu = this->cpu.lock()) { - if (m_btn_run->text() == RunString && cpu->state.test_and_reset(cpu_flag::dbg_pause)) + // Alter dbg_pause bit state (disable->enable, enable->disable) + const auto old = cpu->state.xor_fetch(cpu_flag::dbg_pause); + + // Notify only if no pause flags are set after this change + if (!(old & (cpu_flag::dbg_pause + cpu_flag::dbg_global_pause))) { - if (!(cpu->state & (cpu_flag::dbg_pause + cpu_flag::dbg_global_pause))) - { - cpu->notify(); - } - } - else - { - cpu->state += cpu_flag::dbg_pause; + cpu->notify(); } } UpdateUI();