mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
CPUThread.cpp: Fix use of cpu_counter::add
This also fixes a crash when saving savestate because main thread uses cpu_counter::suspend_all which adds cuncurrency.
This commit is contained in:
parent
9ff91c29f2
commit
c44cddabfa
1 changed files with 13 additions and 6 deletions
|
@ -789,6 +789,19 @@ bool cpu_thread::check_state() noexcept
|
|||
return store;
|
||||
}
|
||||
|
||||
if (s_tls_thread_slot == umax)
|
||||
{
|
||||
if (cpu_flag::wait - state)
|
||||
{
|
||||
// Force wait flag (must be set during ownership of s_cpu_lock), this makes the atomic op fail as a side effect
|
||||
state += cpu_flag::wait;
|
||||
store = true;
|
||||
}
|
||||
|
||||
// Restore thread in the suspend list
|
||||
cpu_counter::add(this);
|
||||
}
|
||||
|
||||
if (flags & cpu_flag::wait)
|
||||
{
|
||||
flags -= cpu_flag::wait;
|
||||
|
@ -843,12 +856,6 @@ bool cpu_thread::check_state() noexcept
|
|||
|
||||
if (escape)
|
||||
{
|
||||
if (s_tls_thread_slot == umax && !retval)
|
||||
{
|
||||
// Restore thread in the suspend list
|
||||
cpu_counter::add(this);
|
||||
}
|
||||
|
||||
if (cpu_can_stop && state0 & cpu_flag::pending)
|
||||
{
|
||||
// Execute pending work
|
||||
|
|
Loading…
Add table
Reference in a new issue