boot: refactor for R_TRY

This commit is contained in:
Michael Scire 2019-06-20 00:57:17 -07:00
parent 491383c637
commit 7b6050a0cb
16 changed files with 223 additions and 623 deletions

View file

@ -24,16 +24,14 @@ static Result RetryUntilSuccess(F f) {
u64 cur_time = 0;
while (true) {
Result rc = f();
if (R_SUCCEEDED(rc)) {
return rc;
} else {
R_TRY_CLEANUP(f(), {
cur_time += retry_interval;
if (cur_time >= timeout) {
return rc;
if (cur_time < timeout) {
svcSleepThread(retry_interval);
continue;
}
}
svcSleepThread(retry_interval);
});
return ResultSuccess;
}
}