mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-21 18:00:34 +00:00
sys_lwcond: Fix rare race on mode 3 signal (#12413)
This commit is contained in:
parent
3e923b4993
commit
0e1931f178
1 changed files with 8 additions and 2 deletions
|
@ -165,13 +165,19 @@ error_code _sys_lwcond_signal(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id, u6
|
||||||
{
|
{
|
||||||
// Respect ordering of the sleep queue
|
// Respect ordering of the sleep queue
|
||||||
mutex->sq.emplace_back(result);
|
mutex->sq.emplace_back(result);
|
||||||
result = mutex->schedule<ppu_thread>(mutex->sq, mutex->protocol);
|
auto result2 = mutex->schedule<ppu_thread>(mutex->sq, mutex->protocol);
|
||||||
|
|
||||||
if (static_cast<ppu_thread*>(result)->state & cpu_flag::again)
|
if (static_cast<ppu_thread*>(result2)->state & cpu_flag::again)
|
||||||
{
|
{
|
||||||
ppu.state += cpu_flag::again;
|
ppu.state += cpu_flag::again;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result2 != result)
|
||||||
|
{
|
||||||
|
cond.awake(result2);
|
||||||
|
result = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (mode == 1)
|
else if (mode == 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue