mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
SPU: Use optimized PPU signaling to SPU on reservation pause
This commit is contained in:
parent
525453794f
commit
b38580bf32
2 changed files with 68 additions and 41 deletions
|
|
@ -129,9 +129,30 @@ namespace vm
|
|||
{
|
||||
if (g_tls_locked && *g_tls_locked == &cpu) [[unlikely]]
|
||||
{
|
||||
if (cpu.state & cpu_flag::wait)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
g_mutex.lock_unlock();
|
||||
cpu.state -= cpu_flag::wait + cpu_flag::memory;
|
||||
|
||||
if (g_mutex.is_lockable()) [[likely]]
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cpu.state += cpu_flag::wait;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpu.state & cpu_flag::memory)
|
||||
{
|
||||
cpu.state -= cpu_flag::memory;
|
||||
}
|
||||
|
||||
if (g_mutex.is_lockable()) [[likely]]
|
||||
{
|
||||
// Optimistic path (hope that mutex is not exclusively locked)
|
||||
|
|
@ -355,7 +376,8 @@ namespace vm
|
|||
|
||||
for (auto lock = g_locks.cbegin(), end = lock + g_cfg.core.ppu_threads; lock != end; lock++)
|
||||
{
|
||||
while (*lock)
|
||||
cpu_thread* ptr;
|
||||
while ((ptr = *lock) && !(ptr->state & cpu_flag::wait))
|
||||
{
|
||||
_mm_pause();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue