1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Replace some uses of Emu.IsStopped()

Poll thread state instead.
This commit is contained in:
Nekotekina 2019-10-12 21:12:47 +03:00
parent 9ae08946ac
commit 16dd72b3e3
7 changed files with 12 additions and 12 deletions

View File

@ -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))

View File

@ -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();

View File

@ -28,7 +28,7 @@ void fmt_class_string<microphone_handler>::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

View File

@ -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);
}

View File

@ -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());
}
};

View File

@ -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?

View File

@ -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<char*>(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))
{