[Kernel::WaitSync1] Instant timeout if ns == 0

This commit is contained in:
wheremyfoodat 2023-04-20 02:48:57 +03:00
parent 2b492a435e
commit 920fd4cf0d
2 changed files with 9 additions and 0 deletions

View file

@ -23,6 +23,9 @@ namespace SVCResult {
BadThreadPriority = 0xE0E01BFD,
PortNameTooLong = 0xE0E0181E,
// Returned when a thread stops waiting due to timing out
Timeout = 0x9401BFE,
};
}

View file

@ -103,6 +103,12 @@ void Kernel::waitSynchronization1() {
if (!shouldWaitOnObject(object)) {
regs[0] = SVCResult::Success;
} else {
// Timeout is 0, don't bother waiting, instantly timeout
if (ns == 0) {
regs[0] = SVCResult::Timeout;
return;
}
regs[0] = SVCResult::Success;
auto& t = threads[currentThreadIndex];