mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 17:58:37 +12:00
Implement stop watchdog
Shows fatal error if stopping takes more than 5s.
This commit is contained in:
parent
a2b6546d37
commit
609c0d46af
1 changed files with 16 additions and 0 deletions
|
@ -1643,6 +1643,22 @@ void Emulator::Stop(bool restart)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
named_thread stop_watchdog("Stop Watchdog", [&]()
|
||||||
|
{
|
||||||
|
const auto start = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
|
while (thread_ctrl::state() != thread_state::aborting)
|
||||||
|
{
|
||||||
|
if (std::chrono::steady_clock::now() - start >= 5s)
|
||||||
|
{
|
||||||
|
report_fatal_error("Stopping emulator took too long."
|
||||||
|
"\nSome thread has probably deadlocked. Aborting.");
|
||||||
|
}
|
||||||
|
|
||||||
|
thread_ctrl::wait_for(100'000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const bool full_stop = !restart && !m_force_boot;
|
const bool full_stop = !restart && !m_force_boot;
|
||||||
const bool do_exit = full_stop && g_cfg.misc.autoexit;
|
const bool do_exit = full_stop && g_cfg.misc.autoexit;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue