sys_cond_wait: Fix mutex acquire when signaling thread didnt pass ownership immediatly

This commit is contained in:
Eladash 2019-10-14 23:36:48 +03:00 committed by Ivan
parent ab02c56725
commit b03c2fc856

View file

@ -1,4 +1,4 @@
#include "stdafx.h" #include "stdafx.h"
#include "sys_cond.h" #include "sys_cond.h"
#include "Emu/System.h" #include "Emu/System.h"
@ -273,17 +273,21 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout)
ppu.gpr[3] = CELL_ETIMEDOUT; ppu.gpr[3] = CELL_ETIMEDOUT;
// Own or requeue // Own or requeue
if (!cond->mutex->try_own(ppu, ppu.id)) if (cond->mutex->try_own(ppu, ppu.id))
{ {
break;
}
}
else if (cond->mutex->owner >> 1 == ppu.id)
{
break;
}
cond->mutex->sleep(ppu); cond->mutex->sleep(ppu);
timeout = 0; timeout = 0;
continue; continue;
} }
} }
break;
}
}
else else
{ {
thread_ctrl::wait(); thread_ctrl::wait();