mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-15 15:44:23 -04:00
boot: refactor for R_TRY
This commit is contained in:
parent
491383c637
commit
7b6050a0cb
16 changed files with 223 additions and 623 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue