mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-08 07:51:28 +12:00
Fix most of "[x] thread is too sleepy" at Emu.Stop() (#9813)
* Fixes some thread sleep/wait calls
This commit is contained in:
parent
a47bda026b
commit
eb0d006168
11 changed files with 21 additions and 17 deletions
|
@ -437,7 +437,7 @@ void cpu_thread::operator()()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can we have a little race, right? First thread is started concurrently with g_fxo->init()
|
// Can we have a little race, right? First thread is started concurrently with g_fxo->init()
|
||||||
std::this_thread::sleep_for(1ms);
|
thread_ctrl::wait_for(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (id_type())
|
switch (id_type())
|
||||||
|
|
|
@ -104,7 +104,7 @@ struct msg_dlg_thread_info
|
||||||
if (wait_until.load() != new_value)
|
if (wait_until.load() != new_value)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
std::this_thread::sleep_for(10ms);
|
thread_ctrl::wait_for(10'000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
|
if (auto manager = g_fxo->get<rsx::overlays::display_manager>())
|
||||||
|
|
|
@ -569,7 +569,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||||
const auto lv2_sleep = [](ppu_thread& ppu, usz sleep_time)
|
const auto lv2_sleep = [](ppu_thread& ppu, usz sleep_time)
|
||||||
{
|
{
|
||||||
lv2_obj::sleep(ppu);
|
lv2_obj::sleep(ppu);
|
||||||
std::this_thread::sleep_for(std::chrono::microseconds(sleep_time));
|
lv2_obj::wait_timeout(sleep_time);
|
||||||
ppu.check_state();
|
ppu.check_state();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -362,6 +362,11 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto cpu0 = get_current_cpu_thread(); cpu0 && cpu0->is_stopped())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (thread_ctrl::state() == thread_state::aborting)
|
if (thread_ctrl::state() == thread_state::aborting)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -304,10 +304,7 @@ void usb_handler_thread::operator()()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is no handled devices usb thread is not actively needed
|
// If there is no handled devices usb thread is not actively needed
|
||||||
if (handled_devices.empty())
|
thread_ctrl::wait_for(handled_devices.empty() ? 500'000 : 200);
|
||||||
std::this_thread::sleep_for(500ms);
|
|
||||||
else
|
|
||||||
std::this_thread::sleep_for(200us);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -664,7 +664,7 @@ void np_handler::operator()()
|
||||||
{
|
{
|
||||||
if (!rpcn.manage_connection())
|
if (!rpcn.manage_connection())
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(200ms);
|
thread_ctrl::wait_for(200'000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ bool rpcn_client::connect(const std::string& host)
|
||||||
connected = true;
|
connected = true;
|
||||||
|
|
||||||
while (!server_info_received && connected && !is_abort())
|
while (!server_info_received && connected && !is_abort())
|
||||||
std::this_thread::sleep_for(5ms);
|
thread_ctrl::wait_for(5000);
|
||||||
|
|
||||||
if (received_version != RPCN_PROTOCOL_VERSION)
|
if (received_version != RPCN_PROTOCOL_VERSION)
|
||||||
{
|
{
|
||||||
|
@ -561,7 +561,7 @@ bool rpcn_client::get_reply(const u32 expected_id, std::vector<u8>& data)
|
||||||
{
|
{
|
||||||
if (check_for_reply())
|
if (check_for_reply())
|
||||||
return true;
|
return true;
|
||||||
std::this_thread::sleep_for(5ms);
|
thread_ctrl::wait_for(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_for_reply())
|
if (check_for_reply())
|
||||||
|
|
|
@ -190,7 +190,7 @@ namespace rsx
|
||||||
for (const auto& replay_cmd : frame->replay_commands)
|
for (const auto& replay_cmd : frame->replay_commands)
|
||||||
{
|
{
|
||||||
while (Emu.IsPaused())
|
while (Emu.IsPaused())
|
||||||
std::this_thread::sleep_for(10ms);
|
thread_ctrl::wait_for(10'000);
|
||||||
|
|
||||||
if (Emu.IsStopped())
|
if (Emu.IsStopped())
|
||||||
break;
|
break;
|
||||||
|
@ -203,7 +203,7 @@ namespace rsx
|
||||||
while (!Emu.IsStopped() && !render->is_fifo_idle() && (render->ctrl->get != fifo_stops[stopIdx]))
|
while (!Emu.IsStopped() && !render->is_fifo_idle() && (render->ctrl->get != fifo_stops[stopIdx]))
|
||||||
{
|
{
|
||||||
while (Emu.IsPaused())
|
while (Emu.IsPaused())
|
||||||
std::this_thread::sleep_for(10ms);
|
thread_ctrl::wait_for(10'000);
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ namespace rsx
|
||||||
while (!render->is_fifo_idle() && !Emu.IsStopped())
|
while (!render->is_fifo_idle() && !Emu.IsStopped())
|
||||||
{
|
{
|
||||||
while (Emu.IsPaused())
|
while (Emu.IsPaused())
|
||||||
std::this_thread::sleep_for(10ms);
|
thread_ctrl::wait_for(10'000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the captured application used syscall instead of a gcm command to flip
|
// Check if the captured application used syscall instead of a gcm command to flip
|
||||||
|
@ -236,7 +236,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
// random pause to not destroy gpu
|
// random pause to not destroy gpu
|
||||||
std::this_thread::sleep_for(10ms);
|
thread_ctrl::wait_for(10'000);
|
||||||
}
|
}
|
||||||
|
|
||||||
get_current_cpu_thread()->state += (cpu_flag::exit + cpu_flag::wait);
|
get_current_cpu_thread()->state += (cpu_flag::exit + cpu_flag::wait);
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace gl
|
||||||
job.completion_callback(result);
|
job.completion_callback(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_work_queue.wait();
|
thread_ctrl::wait_on(m_work_queue, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace vk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_work_queue.wait();
|
thread_ctrl::wait_on(m_work_queue, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,9 @@ namespace rsx
|
||||||
u32 last_update_progress = 0;
|
u32 last_update_progress = 0;
|
||||||
while ((current_progress < entry_count) && !Emu.IsStopped())
|
while ((current_progress < entry_count) && !Emu.IsStopped())
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(16ms); // Around 60fps should be good enough
|
thread_ctrl::wait_for(16'000); // Around 60fps should be good enough
|
||||||
|
|
||||||
|
if (Emu.IsStopped()) break;
|
||||||
|
|
||||||
current_progress = std::min(processed.load(), entry_count);
|
current_progress = std::min(processed.load(), entry_count);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue