coreinit: Fix potential race condition in IPC code

This commit is contained in:
Exzap 2023-10-18 10:43:36 +02:00
parent 9ec50b865d
commit 9bb409314d

View file

@ -578,8 +578,12 @@ namespace iosu
return r;
}
std::mutex sMtxReply[3];
void _IPCReplyAndRelease(IOSDispatchableCommand* dispatchCmd, uint32 result)
{
cemu_assert(dispatchCmd->ppcCoreIndex < 3);
std::unique_lock _l(sMtxReply[(uint32)dispatchCmd->ppcCoreIndex]);
cemu_assert(dispatchCmd >= sIPCDispatchableCommandPool.GetPtr() && dispatchCmd < sIPCDispatchableCommandPool.GetPtr() + sIPCDispatchableCommandPool.GetCount());
dispatchCmd->originalBody->result = result;
// submit to COS