diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 70f100d46f..c72c02a2ef 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -134,7 +134,7 @@ void cpu_thread::operator()() g_cpu_suspend_lock.lock_unlock(); // Check thread status - while (!(state & (cpu_flag::exit + cpu_flag::dbg_global_stop)) && !Emu.IsStopped()) + while (!(state & (cpu_flag::exit + cpu_flag::dbg_global_stop)) && thread_ctrl::state() != thread_state::aborting) { // Check stop status if (!(state & cpu_flag::stop)) diff --git a/rpcs3/Emu/Cell/Modules/cellAudio.cpp b/rpcs3/Emu/Cell/Modules/cellAudio.cpp index 0c2666bd9c..407d1ead79 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudio.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudio.cpp @@ -489,7 +489,7 @@ void cell_audio_thread::operator()() u32 in_progress_expected = 0; // Main cellAudio loop - while (thread_ctrl::state() != thread_state::aborting && !Emu.IsStopped()) + while (thread_ctrl::state() != thread_state::aborting) { const u64 timestamp = ringbuffer->update(); diff --git a/rpcs3/Emu/Cell/Modules/cellMic.cpp b/rpcs3/Emu/Cell/Modules/cellMic.cpp index 50532fb343..8f9682d0c1 100644 --- a/rpcs3/Emu/Cell/Modules/cellMic.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMic.cpp @@ -28,7 +28,7 @@ void fmt_class_string::format(std::string& out, u64 arg) void mic_context::operator()() { - while (thread_ctrl::state() != thread_state::aborting && !Emu.IsStopped()) + while (thread_ctrl::state() != thread_state::aborting) { // The time between processing is copied from audio thread // Might be inaccurate for mic thread diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/Emu/Cell/Modules/cellVdec.cpp index f68eb8da92..ff3ba7202c 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -180,7 +180,7 @@ struct vdec_context final { ppu_tid = ppu.id; - for (auto cmds = in_cmd.pop_all(); !Emu.IsStopped(); cmds ? cmds.pop_front() : cmds = in_cmd.pop_all()) + for (auto cmds = in_cmd.pop_all(); thread_ctrl::state() != thread_state::aborting; cmds ? cmds.pop_front() : cmds = in_cmd.pop_all()) { if (!cmds) { @@ -394,7 +394,7 @@ struct vdec_context final au_count--; } - while (!Emu.IsStopped() && out_max && (std::lock_guard{mutex}, out.size() > out_max)) + while (thread_ctrl::state() != thread_state::aborting && out_max && (std::lock_guard{mutex}, out.size() > out_max)) { thread_ctrl::wait_for(1000); } diff --git a/rpcs3/Emu/Cell/lv2/sys_net.cpp b/rpcs3/Emu/Cell/lv2/sys_net.cpp index e2bee9a9d2..e1ab60dda3 100644 --- a/rpcs3/Emu/Cell/lv2/sys_net.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_net.cpp @@ -142,7 +142,7 @@ struct network_thread ::pollfd fds[lv2_socket::id_count]{}; #endif - do + while (thread_ctrl::state() != thread_state::aborting) { // Wait with 1ms timeout #ifdef _WIN32 @@ -254,7 +254,6 @@ struct network_thread #endif } } - while (!Emu.IsStopped()); } }; diff --git a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp index 41b370a019..5a845cbf3c 100644 --- a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp @@ -223,7 +223,7 @@ void usb_handler_thread::operator()() memset(&lusb_tv, 0, sizeof(timeval)); lusb_tv.tv_usec = 200; - while (thread_ctrl::state() != thread_state::aborting && !Emu.IsStopped()) + while (thread_ctrl::state() != thread_state::aborting) { // Todo: Hotplug here? diff --git a/rpcs3/Emu/GDB.cpp b/rpcs3/Emu/GDB.cpp index e4c872ec66..a3a4dde20c 100644 --- a/rpcs3/Emu/GDB.cpp +++ b/rpcs3/Emu/GDB.cpp @@ -213,7 +213,7 @@ void gdb_thread::start_server() int gdb_thread::read(void* buf, int cnt) { - while (!Emu.IsStopped()) + while (thread_ctrl::state() != thread_state::aborting) { int result = recv(client_socket, reinterpret_cast(buf), cnt, 0); @@ -332,7 +332,8 @@ bool gdb_thread::read_cmd(gdb_cmd& out_cmd) void gdb_thread::send(const char* buf, int cnt) { GDB.trace("Sending %s (%d bytes).", buf, cnt); - while (!Emu.IsStopped()) + + while (thread_ctrl::state() != thread_state::aborting) { int res = ::send(client_socket, buf, cnt, 0); if (res == -1) @@ -852,7 +853,7 @@ void gdb_thread::operator()() { start_server(); - while (server_socket != -1 && !Emu.IsStopped()) + while (server_socket != -1 && thread_ctrl::state() != thread_state::aborting) { sockaddr_in client; socklen_t client_len = sizeof(client); @@ -881,7 +882,7 @@ void gdb_thread::operator()() gdb_cmd cmd; - while (!Emu.IsStopped()) + while (thread_ctrl::state() != thread_state::aborting) { if (!read_cmd(cmd)) {