Commit e4fb76b6 authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook GitHub Bot

Don't throw in noexcept ViaIfAsyncAwaiter::await_suspend

Summary: Avoids warnings with -Wterminate.

Reviewed By: yfeldblum

Differential Revision: D27452798

fbshipit-source-id: 129b66179c5ff9bbf3f8fe791224cd925a3b33f3
parent 716ff89f
......@@ -315,20 +315,23 @@ class ViaIfAsyncAwaiter {
folly::deactivateAsyncStackFrame(asyncFrame);
try {
if constexpr (std::is_same_v<await_suspend_result_t, bool>) {
if (!awaiter_.await_suspend(viaCoroutine_.getHandle())) {
// Reactivate the stack-frame before we resume.
folly::activateAsyncStackFrame(stackRoot, asyncFrame);
return false;
}
return true;
} else {
return awaiter_.await_suspend(viaCoroutine_.getHandle());
// Reactivate the stack-frame before we resume.
auto rollback =
makeGuard([&] { activateAsyncStackFrame(stackRoot, asyncFrame); });
if constexpr (std::is_same_v<await_suspend_result_t, bool>) {
if (!awaiter_.await_suspend(viaCoroutine_.getHandle())) {
return false;
}
} catch (...) {
folly::activateAsyncStackFrame(stackRoot, asyncFrame);
throw;
rollback.dismiss();
return true;
} else if constexpr (std::is_same_v<await_suspend_result_t, void>) {
awaiter_.await_suspend(viaCoroutine_.getHandle());
rollback.dismiss();
return;
} else {
auto ret = awaiter_.await_suspend(viaCoroutine_.getHandle());
rollback.dismiss();
return ret;
}
} else {
return awaiter_.await_suspend(viaCoroutine_.getHandle());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment