mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
More optimization for cpu_thread::suspend_all
Try to not pause inactive threads.
This commit is contained in:
parent
b74c5e04f5
commit
ec7d243ee9
@ -605,6 +605,13 @@ bool cpu_thread::check_state() noexcept
|
||||
|
||||
if (escape)
|
||||
{
|
||||
if (s_tls_thread_slot == umax)
|
||||
{
|
||||
// Restore thread in the suspend list
|
||||
std::lock_guard lock(g_fxo->get<cpu_counter>()->cpu_suspend_lock);
|
||||
s_tls_thread_slot = g_fxo->get<cpu_counter>()->add(this, true);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -612,6 +619,15 @@ bool cpu_thread::check_state() noexcept
|
||||
{
|
||||
cpu_sleep();
|
||||
cpu_sleep_called = true;
|
||||
|
||||
if (s_tls_thread_slot != umax)
|
||||
{
|
||||
// Exclude inactive threads from the suspend list (optimization)
|
||||
std::lock_guard lock(g_fxo->get<cpu_counter>()->cpu_suspend_lock);
|
||||
g_fxo->get<cpu_counter>()->remove(this);
|
||||
s_tls_thread_slot = -1;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user