Integrate new result macros. (#1780)

* result: try out some experimental shenanigans

* result: sketch out some more shenanigans

* result: see what it looks like to convert kernel to use result conds instead of guards

* make rest of kernel use experimental new macro-ing
This commit is contained in:
SciresM 2022-02-14 14:45:32 -08:00 committed by GitHub
parent 375ba615be
commit 96f95b9f95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
109 changed files with 1355 additions and 1380 deletions

View file

@ -98,12 +98,12 @@ namespace ams::kern {
/* Signal the next owner thread. */
next_owner_thread->EndWait(result);
return result;
R_RETURN(result);
} else {
/* Just write the value to userspace. */
R_UNLESS(WriteToUser(addr, std::addressof(next_value)), svc::ResultInvalidCurrentMemory());
return ResultSuccess();
R_SUCCEED();
}
}
}
@ -143,7 +143,7 @@ namespace ams::kern {
owner_thread->Close();
/* Get the wait result. */
return cur_thread->GetWaitResult();
R_RETURN(cur_thread->GetWaitResult());
}
void KConditionVariable::SignalImpl(KThread *thread) {
@ -224,7 +224,7 @@ namespace ams::kern {
/* Check that the thread isn't terminating. */
if (cur_thread->IsTerminationRequested()) {
slp.CancelSleep();
return svc::ResultTerminationRequested();
R_THROW(svc::ResultTerminationRequested());
}
/* Update the value and process for the next owner. */
@ -256,7 +256,7 @@ namespace ams::kern {
/* Write the value to userspace. */
if (!WriteToUser(addr, std::addressof(next_value))) {
slp.CancelSleep();
return svc::ResultInvalidCurrentMemory();
R_THROW(svc::ResultInvalidCurrentMemory());
}
}
@ -273,7 +273,7 @@ namespace ams::kern {
}
/* Get the wait result. */
return cur_thread->GetWaitResult();
R_RETURN(cur_thread->GetWaitResult());
}
}