mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12: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;
|
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)
|
if (flags & cpu_flag::wait)
|
||||||
{
|
{
|
||||||
flags -= cpu_flag::wait;
|
flags -= cpu_flag::wait;
|
||||||
|
@ -843,12 +856,6 @@ bool cpu_thread::check_state() noexcept
|
||||||
|
|
||||||
if (escape)
|
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)
|
if (cpu_can_stop && state0 & cpu_flag::pending)
|
||||||
{
|
{
|
||||||
// Execute pending work
|
// Execute pending work
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue