1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 12:42:41 +01:00

Improve Stop Watchdog

Make it less possible to interfere with the debugger.
This commit is contained in:
Nekotekina 2020-03-10 22:58:59 +03:00
parent 656db6c668
commit 92eeec39b7

View File

@ -1645,17 +1645,17 @@ void Emulator::Stop(bool restart)
named_thread stop_watchdog("Stop Watchdog", [&]()
{
const auto start = std::chrono::steady_clock::now();
while (thread_ctrl::state() != thread_state::aborting)
for (uint i = 0; thread_ctrl::state() != thread_state::aborting; i++)
{
if (std::chrono::steady_clock::now() - start >= 5s)
// We don't need accurate timekeeping, using clocks may interfere with debugging
if (i >= 1000)
{
// Total amount of waiting: about 5s
report_fatal_error("Stopping emulator took too long."
"\nSome thread has probably deadlocked. Aborting.");
}
thread_ctrl::wait_for(100'000);
thread_ctrl::wait_for(5'000);
}
});