boot: refactor for R_TRY

This commit is contained in:
Michael Scire committed 2019-06-20 00:57:17 -07:00
1 parent 491383c637
commit 7b6050a0cb
16 files changed
+223 -623

No files matched your search

+6 -8
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;
}
}