From 223319dd2e49de450c70bdfb88df787b9608062a Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 8 Sep 2019 23:59:08 +0300 Subject: [PATCH] Abort named_thread in cpu_thread::stop_all --- rpcs3/Emu/CPU/CPUThread.cpp | 18 +++++++++++++++++- rpcs3/Emu/CPU/CPUThread.h | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 0c9903b917..37eeeb4633 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -310,6 +310,22 @@ void cpu_thread::notify() } } +void cpu_thread::abort() +{ + if (id_type() == 1) + { + *static_cast*>(this) = thread_state::aborting; + } + else if (id_type() == 2) + { + *static_cast*>(this) = thread_state::aborting; + } + else + { + fmt::throw_exception("Invalid cpu_thread type"); + } +} + std::string cpu_thread::dump() const { return fmt::format("Type: %s\n" "State: %s\n", typeid(*this).name(), state.load()); @@ -391,7 +407,7 @@ void cpu_thread::stop_all() noexcept for_all_cpu([](cpu_thread* cpu) { cpu->state += cpu_flag::dbg_global_stop; - cpu->notify(); + cpu->abort(); }); } diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index dfbb252e63..fe142cec35 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -81,6 +81,11 @@ public: // Upcast and notify void notify(); +private: + // Upcast and abort + void abort(); + +public: // Thread stats for external observation static atomic_t g_threads_created, g_threads_deleted;