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 { ...@@ -315,20 +315,23 @@ class ViaIfAsyncAwaiter {
folly::deactivateAsyncStackFrame(asyncFrame); folly::deactivateAsyncStackFrame(asyncFrame);
try { // Reactivate the stack-frame before we resume.
if constexpr (std::is_same_v<await_suspend_result_t, bool>) { auto rollback =
if (!awaiter_.await_suspend(viaCoroutine_.getHandle())) { makeGuard([&] { activateAsyncStackFrame(stackRoot, asyncFrame); });
// Reactivate the stack-frame before we resume. if constexpr (std::is_same_v<await_suspend_result_t, bool>) {
folly::activateAsyncStackFrame(stackRoot, asyncFrame); if (!awaiter_.await_suspend(viaCoroutine_.getHandle())) {
return false; return false;
}
return true;
} else {
return awaiter_.await_suspend(viaCoroutine_.getHandle());
} }
} catch (...) { rollback.dismiss();
folly::activateAsyncStackFrame(stackRoot, asyncFrame); return true;
throw; } 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 { } else {
return awaiter_.await_suspend(viaCoroutine_.getHandle()); 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