mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
[orbis-kernel] Implement umtx_sem_wait +...
umtx_sem_wake Use duration_cast
This commit is contained in:
parent
b5f8657732
commit
1ea8e148fa
3 changed files with 68 additions and 19 deletions
|
|
@ -66,7 +66,9 @@ orbis::SysResult orbis::sys__umtx_op(Thread *thread, ptr<void> obj, sint op,
|
|||
while (true) {
|
||||
if (auto r = op(usec - udiff); r != ErrorCode::TIMEDOUT)
|
||||
return r;
|
||||
udiff = (std::chrono::steady_clock::now() - start).count() / 1000;
|
||||
udiff = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
.count();
|
||||
if (udiff >= usec)
|
||||
return ErrorCode::TIMEDOUT;
|
||||
}
|
||||
|
|
@ -142,9 +144,13 @@ orbis::SysResult orbis::sys__umtx_op(Thread *thread, ptr<void> obj, sint op,
|
|||
case 18:
|
||||
return umtx_wake_umutex(thread, (ptr<umutex>)obj);
|
||||
case 19:
|
||||
return umtx_sem_wait(thread, obj, val, uaddr1, uaddr2);
|
||||
return with_timeout(
|
||||
[&](std::uint64_t ut) {
|
||||
return umtx_sem_wait(thread, (ptr<usem>)obj, ut);
|
||||
},
|
||||
false);
|
||||
case 20:
|
||||
return umtx_sem_wake(thread, obj, val, uaddr1, uaddr2);
|
||||
return umtx_sem_wake(thread, (ptr<usem>)obj);
|
||||
case 21:
|
||||
return umtx_nwake_private(thread, (ptr<void *>)obj, val);
|
||||
case 22:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue