mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
waiter_op() and waiter_signal() basis
Simplified signaling on condition variables without using them directly.
This commit is contained in:
parent
446993eaa6
commit
3c2e0fff07
3 changed files with 98 additions and 9 deletions
|
|
@ -60,15 +60,10 @@ s32 cellSyncMutexLock(vm::ptr<CellSyncMutex> mutex)
|
|||
});
|
||||
|
||||
// prx: wait until this old value is equal to m_rel
|
||||
while (order != mutex->data.read_relaxed().m_rel)
|
||||
waiter_op(__FUNCTION__, mutex.addr(), [mutex, order]()
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
cellSync->Warning("cellSyncMutexLock(mutex_addr=0x%x) aborted", mutex.addr());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return order == mutex->data.read_relaxed().m_rel;
|
||||
});
|
||||
|
||||
// prx: sync
|
||||
mutex->data.read_sync();
|
||||
|
|
@ -116,6 +111,8 @@ s32 cellSyncMutexUnlock(vm::ptr<CellSyncMutex> mutex)
|
|||
{
|
||||
mutex.m_rel++;
|
||||
});
|
||||
|
||||
waiter_signal(mutex.addr());
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue