waiter_op() and waiter_signal() basis

Simplified signaling on condition variables without using them directly.
This commit is contained in:
Nekotekina 2014-10-11 01:33:57 +04:00
parent 446993eaa6
commit 3c2e0fff07
3 changed files with 98 additions and 9 deletions

View file

@ -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;
}