mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
More optimization for cpu_thread::suspend_all
Try to not pause inactive threads.
This commit is contained in:
parent
b74c5e04f5
commit
ec7d243ee9
1 changed files with 16 additions and 0 deletions
|
@ -605,6 +605,13 @@ bool cpu_thread::check_state() noexcept
|
||||||
|
|
||||||
if (escape)
|
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;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,6 +619,15 @@ bool cpu_thread::check_state() noexcept
|
||||||
{
|
{
|
||||||
cpu_sleep();
|
cpu_sleep();
|
||||||
cpu_sleep_called = true;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue