From 92eeec39b71ad87a668cf58bf73026e4e51dd519 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 10 Mar 2020 22:58:59 +0300 Subject: [PATCH] Improve Stop Watchdog Make it less possible to interfere with the debugger. --- rpcs3/Emu/System.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index f6f303a2eb..3b060298a2 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -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); } });