mirror of https://github.com/RPCS3/rpcs3.git
Improve Stop Watchdog
Make it less possible to interfere with the debugger.
This commit is contained in:
parent
656db6c668
commit
92eeec39b7
|
@ -1645,17 +1645,17 @@ void Emulator::Stop(bool restart)
|
||||||
|
|
||||||
named_thread stop_watchdog("Stop Watchdog", [&]()
|
named_thread stop_watchdog("Stop Watchdog", [&]()
|
||||||
{
|
{
|
||||||
const auto start = std::chrono::steady_clock::now();
|
for (uint i = 0; thread_ctrl::state() != thread_state::aborting; i++)
|
||||||
|
|
||||||
while (thread_ctrl::state() != thread_state::aborting)
|
|
||||||
{
|
{
|
||||||
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."
|
report_fatal_error("Stopping emulator took too long."
|
||||||
"\nSome thread has probably deadlocked. Aborting.");
|
"\nSome thread has probably deadlocked. Aborting.");
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_ctrl::wait_for(100'000);
|
thread_ctrl::wait_for(5'000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue