Skip to content

Commit

Permalink
chore: catch synclaunch exception
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Sep 9, 2024
1 parent f58302e commit 2c7001f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/ll/api/coro/CoroTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,18 @@ class CoroTask {
}(std::move(*this), std::forward<F>(callback));
}

ExpectedT syncLaunch(Executor const& executor) {
std::binary_semaphore cond{0};
ExpectedT value;
launch(executor, [&](ExpectedT&& result) {
value = std::move(result);
cond.release();
});
cond.acquire();
ExpectedT syncLaunch(Executor const& executor) noexcept {
ExpectedT value;
try {
std::binary_semaphore cond{0};
launch(executor, [&](ExpectedT&& result) {
value = std::move(result);
cond.release();
});
cond.acquire();
} catch (...) {
value = makeExceptionError();
}
return value;
}
};
Expand Down

0 comments on commit 2c7001f

Please sign in to comment.