1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Report deadlocked thread names in failures to stop emulation (#9865)

* Report deadlocked thread names in failures to stop emulation

Co-authored-by: Nekotekina <nekotekina@gmail.com>
This commit is contained in:
Eladash 2021-03-01 00:06:48 +02:00 committed by GitHub
parent 71e16bfac3
commit 48cd56acc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2338,7 +2338,6 @@ bool thread_base::join(bool dtor) const
// Hacked for too sleepy threads (1ms) TODO: make sure it's unneeded and remove
const auto timeout = dtor && Emu.IsStopped() ? atomic_wait_timeout{1'000'000} : atomic_wait_timeout::inf;
bool warn = false;
auto stamp0 = __rdtsc();
for (u64 i = 0; (m_sync & 3) <= 1; i++)
@ -2350,18 +2349,12 @@ bool thread_base::join(bool dtor) const
break;
}
if (i > 20 && Emu.IsStopped())
if (i >= 16 && !(i & (i - 1)) && timeout != atomic_wait_timeout::inf)
{
atomic_wait_engine::raw_notify(0, get_native_id());
warn = true;
sig_log.error(u8"Thread [%s] is too sleepy. Waiting for it %.3fµs already!", *m_tname.load(), (__rdtsc() - stamp0) / (utils::get_tsc_freq() / 1000000.));
}
}
if (warn)
{
sig_log.error(u8"Thread [%s] is too sleepy. Took %.3fµs to wake it up!", *m_tname.load(), (__rdtsc() - stamp0) / (utils::get_tsc_freq() / 1000000.));
}
return (m_sync & 3) == 3;
}