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