Commit 56effb5a authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

reexport coroutine_handle

Summary: Reexport `coroutine_handle` from `folly/experimental/coro/Coroutine.h`, which wraps inclusion of `experimental/coroutine`.

Differential Revision: D26227588

fbshipit-source-id: 32cdb2b6d87e90065bf9f140716d63670c04db5f
parent ce0961de
...@@ -52,8 +52,8 @@ class AsyncGeneratorPromise { ...@@ -52,8 +52,8 @@ class AsyncGeneratorPromise {
class YieldAwaiter { class YieldAwaiter {
public: public:
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
std::experimental::coroutine_handle<> await_suspend( coroutine_handle<> await_suspend(
std::experimental::coroutine_handle<AsyncGeneratorPromise> h) noexcept { coroutine_handle<AsyncGeneratorPromise> h) noexcept {
AsyncGeneratorPromise& promise = h.promise(); AsyncGeneratorPromise& promise = h.promise();
// Pop AsyncStackFrame first as clearContext() clears the frame state. // Pop AsyncStackFrame first as clearContext() clears the frame state.
folly::popAsyncStackFrameCallee(promise.getAsyncFrame()); folly::popAsyncStackFrameCallee(promise.getAsyncFrame());
...@@ -194,8 +194,7 @@ class AsyncGeneratorPromise { ...@@ -194,8 +194,7 @@ class AsyncGeneratorPromise {
executor_ = std::move(executor); executor_ = std::move(executor);
} }
void setContinuation( void setContinuation(coroutine_handle<> continuation) noexcept {
std::experimental::coroutine_handle<> continuation) noexcept {
continuation_ = continuation; continuation_ = continuation;
} }
...@@ -253,7 +252,7 @@ class AsyncGeneratorPromise { ...@@ -253,7 +252,7 @@ class AsyncGeneratorPromise {
DONE, DONE,
}; };
std::experimental::coroutine_handle<> continuation_; coroutine_handle<> continuation_;
folly::AsyncStackFrame asyncFrame_; folly::AsyncStackFrame asyncFrame_;
folly::Executor::KeepAlive<> executor_; folly::Executor::KeepAlive<> executor_;
folly::CancellationToken cancelToken_; folly::CancellationToken cancelToken_;
...@@ -366,7 +365,7 @@ class FOLLY_NODISCARD AsyncGenerator { ...@@ -366,7 +365,7 @@ class FOLLY_NODISCARD AsyncGenerator {
using promise_type = detail::AsyncGeneratorPromise<Reference, Value>; using promise_type = detail::AsyncGeneratorPromise<Reference, Value>;
private: private:
using handle_t = std::experimental::coroutine_handle<promise_type>; using handle_t = coroutine_handle<promise_type>;
public: public:
using value_type = Value; using value_type = Value;
...@@ -489,7 +488,7 @@ class FOLLY_NODISCARD AsyncGenerator { ...@@ -489,7 +488,7 @@ class FOLLY_NODISCARD AsyncGenerator {
template <typename Promise> template <typename Promise>
FOLLY_NOINLINE auto await_suspend( FOLLY_NOINLINE auto await_suspend(
std::experimental::coroutine_handle<Promise> continuation) noexcept { coroutine_handle<Promise> continuation) noexcept {
auto& promise = coro_.promise(); auto& promise = coro_.promise();
promise.setContinuation(continuation); promise.setContinuation(continuation);
...@@ -586,11 +585,10 @@ class FOLLY_NODISCARD AsyncGenerator { ...@@ -586,11 +585,10 @@ class FOLLY_NODISCARD AsyncGenerator {
private: private:
friend class detail::AsyncGeneratorPromise<Reference, Value>; friend class detail::AsyncGeneratorPromise<Reference, Value>;
explicit AsyncGenerator( explicit AsyncGenerator(coroutine_handle<promise_type> coro) noexcept
std::experimental::coroutine_handle<promise_type> coro) noexcept
: coro_(coro) {} : coro_(coro) {}
std::experimental::coroutine_handle<promise_type> coro_; coroutine_handle<promise_type> coro_;
}; };
namespace detail { namespace detail {
...@@ -598,8 +596,9 @@ namespace detail { ...@@ -598,8 +596,9 @@ namespace detail {
template <typename Reference, typename Value> template <typename Reference, typename Value>
AsyncGenerator<Reference, Value> AsyncGenerator<Reference, Value>
AsyncGeneratorPromise<Reference, Value>::get_return_object() noexcept { AsyncGeneratorPromise<Reference, Value>::get_return_object() noexcept {
return AsyncGenerator<Reference, Value>{std::experimental::coroutine_handle< return AsyncGenerator<Reference, Value>{
AsyncGeneratorPromise<Reference, Value>>::from_promise(*this)}; coroutine_handle<AsyncGeneratorPromise<Reference, Value>>::from_promise(
*this)};
} }
} // namespace detail } // namespace detail
......
...@@ -33,8 +33,7 @@ class AsyncStackTraceAwaitable { ...@@ -33,8 +33,7 @@ class AsyncStackTraceAwaitable {
bool await_ready() const { return false; } bool await_ready() const { return false; }
template <typename Promise> template <typename Promise>
bool await_suspend( bool await_suspend(coroutine_handle<Promise> h) noexcept {
std::experimental::coroutine_handle<Promise> h) noexcept {
initialFrame_ = &h.promise().getAsyncFrame(); initialFrame_ = &h.promise().getAsyncFrame();
return false; return false;
} }
......
...@@ -95,8 +95,7 @@ class Baton { ...@@ -95,8 +95,7 @@ class Baton {
bool await_ready() const noexcept { return baton_.ready(); } bool await_ready() const noexcept { return baton_.ready(); }
bool await_suspend( bool await_suspend(coroutine_handle<> awaitingCoroutine) noexcept {
std::experimental::coroutine_handle<> awaitingCoroutine) noexcept {
awaitingCoroutine_ = awaitingCoroutine; awaitingCoroutine_ = awaitingCoroutine;
return baton_.waitImpl(this); return baton_.waitImpl(this);
} }
...@@ -107,7 +106,7 @@ class Baton { ...@@ -107,7 +106,7 @@ class Baton {
friend class Baton; friend class Baton;
const Baton& baton_; const Baton& baton_;
std::experimental::coroutine_handle<> awaitingCoroutine_; coroutine_handle<> awaitingCoroutine_;
WaitOperation* next_; WaitOperation* next_;
}; };
......
...@@ -48,8 +48,7 @@ class BlockingWaitPromiseBase { ...@@ -48,8 +48,7 @@ class BlockingWaitPromiseBase {
struct FinalAwaiter { struct FinalAwaiter {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
template <typename Promise> template <typename Promise>
void await_suspend( void await_suspend(coroutine_handle<Promise> coro) noexcept {
std::experimental::coroutine_handle<Promise> coro) noexcept {
BlockingWaitPromiseBase& promise = coro.promise(); BlockingWaitPromiseBase& promise = coro.promise();
folly::deactivateAsyncStackFrame(promise.getAsyncFrame()); folly::deactivateAsyncStackFrame(promise.getAsyncFrame());
promise.baton_.post(); promise.baton_.post();
...@@ -186,7 +185,7 @@ template <typename T> ...@@ -186,7 +185,7 @@ template <typename T>
class BlockingWaitTask { class BlockingWaitTask {
public: public:
using promise_type = BlockingWaitPromise<T>; using promise_type = BlockingWaitPromise<T>;
using handle_t = std::experimental::coroutine_handle<promise_type>; using handle_t = coroutine_handle<promise_type>;
explicit BlockingWaitTask(handle_t coro) noexcept : coro_(coro) {} explicit BlockingWaitTask(handle_t coro) noexcept : coro_(coro) {}
...@@ -247,21 +246,20 @@ template <typename T> ...@@ -247,21 +246,20 @@ template <typename T>
inline BlockingWaitTask<T> inline BlockingWaitTask<T>
BlockingWaitPromise<T>::get_return_object() noexcept { BlockingWaitPromise<T>::get_return_object() noexcept {
return BlockingWaitTask<T>{ return BlockingWaitTask<T>{
std::experimental::coroutine_handle<BlockingWaitPromise<T>>::from_promise( coroutine_handle<BlockingWaitPromise<T>>::from_promise(*this)};
*this)};
} }
template <typename T> template <typename T>
inline BlockingWaitTask<T&> inline BlockingWaitTask<T&>
BlockingWaitPromise<T&>::get_return_object() noexcept { BlockingWaitPromise<T&>::get_return_object() noexcept {
return BlockingWaitTask<T&>{std::experimental::coroutine_handle< return BlockingWaitTask<T&>{
BlockingWaitPromise<T&>>::from_promise(*this)}; coroutine_handle<BlockingWaitPromise<T&>>::from_promise(*this)};
} }
inline BlockingWaitTask<void> inline BlockingWaitTask<void>
BlockingWaitPromise<void>::get_return_object() noexcept { BlockingWaitPromise<void>::get_return_object() noexcept {
return BlockingWaitTask<void>{std::experimental::coroutine_handle< return BlockingWaitTask<void>{
BlockingWaitPromise<void>>::from_promise(*this)}; coroutine_handle<BlockingWaitPromise<void>>::from_promise(*this)};
} }
template < template <
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
namespace folly::coro { namespace folly::coro {
using std::experimental::coroutine_handle;
using std::experimental::suspend_always; using std::experimental::suspend_always;
using std::experimental::suspend_never; using std::experimental::suspend_never;
......
...@@ -75,14 +75,13 @@ class co_reschedule_on_current_executor_ { ...@@ -75,14 +75,13 @@ class co_reschedule_on_current_executor_ {
using AwaiterBase::AwaiterBase; using AwaiterBase::AwaiterBase;
template <typename Promise> template <typename Promise>
void await_suspend( void await_suspend(coroutine_handle<Promise> coro) noexcept {
std::experimental::coroutine_handle<Promise> coro) noexcept {
await_suspend_impl(coro, coro.promise().getAsyncFrame()); await_suspend_impl(coro, coro.promise().getAsyncFrame());
} }
private: private:
FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES void await_suspend_impl( FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES void await_suspend_impl(
std::experimental::coroutine_handle<> coro, coroutine_handle<> coro,
AsyncStackFrame& frame) { AsyncStackFrame& frame) {
auto& stackRoot = *frame.getStackRoot(); auto& stackRoot = *frame.getStackRoot();
folly::deactivateAsyncStackFrame(frame); folly::deactivateAsyncStackFrame(frame);
...@@ -104,7 +103,7 @@ class co_reschedule_on_current_executor_ { ...@@ -104,7 +103,7 @@ class co_reschedule_on_current_executor_ {
using AwaiterBase::AwaiterBase; using AwaiterBase::AwaiterBase;
FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES void await_suspend( FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES void await_suspend(
std::experimental::coroutine_handle<> coro) { coroutine_handle<> coro) {
executor_->add([coro, ctx = RequestContext::saveContext()]() mutable { executor_->add([coro, ctx = RequestContext::saveContext()]() mutable {
RequestContextScopeGuard contextScope{std::move(ctx)}; RequestContextScopeGuard contextScope{std::move(ctx)};
coro.resume(); coro.resume();
......
...@@ -75,8 +75,7 @@ class Generator { ...@@ -75,8 +75,7 @@ class Generator {
bool await_ready() noexcept { return this->m_childPromise == nullptr; } bool await_ready() noexcept { return this->m_childPromise == nullptr; }
void await_suspend( void await_suspend(coroutine_handle<promise_type>) noexcept {}
std::experimental::coroutine_handle<promise_type>) noexcept {}
void await_resume() { void await_resume() {
if (this->m_childPromise != nullptr) { if (this->m_childPromise != nullptr) {
...@@ -110,8 +109,7 @@ class Generator { ...@@ -110,8 +109,7 @@ class Generator {
void await_transform(U&& value) = delete; void await_transform(U&& value) = delete;
void destroy() noexcept { void destroy() noexcept {
std::experimental::coroutine_handle<promise_type>::from_promise(*this) coroutine_handle<promise_type>::from_promise(*this).destroy();
.destroy();
} }
void throw_if_exception() { void throw_if_exception() {
...@@ -121,9 +119,7 @@ class Generator { ...@@ -121,9 +119,7 @@ class Generator {
} }
bool is_complete() noexcept { bool is_complete() noexcept {
return std::experimental::coroutine_handle<promise_type>::from_promise( return coroutine_handle<promise_type>::from_promise(*this).done();
*this)
.done();
} }
T& value() noexcept { T& value() noexcept {
...@@ -146,8 +142,7 @@ class Generator { ...@@ -146,8 +142,7 @@ class Generator {
private: private:
void resume() noexcept { void resume() noexcept {
std::experimental::coroutine_handle<promise_type>::from_promise(*this) coroutine_handle<promise_type>::from_promise(*this).resume();
.resume();
} }
std::add_pointer_t<T> m_value; std::add_pointer_t<T> m_value;
......
...@@ -163,8 +163,7 @@ class Mutex { ...@@ -163,8 +163,7 @@ class Mutex {
bool await_ready() noexcept { return mutex_.try_lock(); } bool await_ready() noexcept { return mutex_.try_lock(); }
bool await_suspend( bool await_suspend(coroutine_handle<> awaitingCoroutine) noexcept {
std::experimental::coroutine_handle<> awaitingCoroutine) noexcept {
awaitingCoroutine_ = awaitingCoroutine; awaitingCoroutine_ = awaitingCoroutine;
return mutex_.lockAsyncImpl(this); return mutex_.lockAsyncImpl(this);
} }
...@@ -177,7 +176,7 @@ class Mutex { ...@@ -177,7 +176,7 @@ class Mutex {
private: private:
friend Mutex; friend Mutex;
std::experimental::coroutine_handle<> awaitingCoroutine_; coroutine_handle<> awaitingCoroutine_;
LockAwaiter* next_; LockAwaiter* next_;
}; };
......
...@@ -206,7 +206,7 @@ class SharedMutexFair { ...@@ -206,7 +206,7 @@ class SharedMutexFair {
SharedMutexFair* mutex_; SharedMutexFair* mutex_;
LockAwaiterBase* nextAwaiter_; LockAwaiterBase* nextAwaiter_;
LockAwaiterBase* nextReader_; LockAwaiterBase* nextReader_;
std::experimental::coroutine_handle<> continuation_; coroutine_handle<> continuation_;
LockType lockType_; LockType lockType_;
}; };
...@@ -218,7 +218,7 @@ class SharedMutexFair { ...@@ -218,7 +218,7 @@ class SharedMutexFair {
bool await_ready() noexcept { return mutex_->try_lock(); } bool await_ready() noexcept { return mutex_->try_lock(); }
FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES bool await_suspend( FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES bool await_suspend(
std::experimental::coroutine_handle<> continuation) noexcept { coroutine_handle<> continuation) noexcept {
auto lock = mutex_->state_.contextualLock(); auto lock = mutex_->state_.contextualLock();
// Exclusive lock can only be acquired if it's currently unlocked. // Exclusive lock can only be acquired if it's currently unlocked.
...@@ -245,7 +245,7 @@ class SharedMutexFair { ...@@ -245,7 +245,7 @@ class SharedMutexFair {
bool await_ready() noexcept { return mutex_->try_lock_shared(); } bool await_ready() noexcept { return mutex_->try_lock_shared(); }
FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES bool await_suspend( FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES bool await_suspend(
std::experimental::coroutine_handle<> continuation) noexcept { coroutine_handle<> continuation) noexcept {
auto lock = mutex_->state_.contextualLock(); auto lock = mutex_->state_.contextualLock();
// shared-lock can be acquired if it's either unlocked or it is // shared-lock can be acquired if it's either unlocked or it is
......
...@@ -63,10 +63,8 @@ class TaskPromiseBase { ...@@ -63,10 +63,8 @@ class TaskPromiseBase {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
template <typename Promise> template <typename Promise>
FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES coroutine_handle<>
std::experimental::coroutine_handle<> await_suspend(coroutine_handle<Promise> coro) noexcept {
await_suspend(
std::experimental::coroutine_handle<Promise> coro) noexcept {
TaskPromiseBase& promise = coro.promise(); TaskPromiseBase& promise = coro.promise();
folly::popAsyncStackFrameCallee(promise.asyncFrame_); folly::popAsyncStackFrameCallee(promise.asyncFrame_);
return promise.continuation_; return promise.continuation_;
...@@ -134,7 +132,7 @@ class TaskPromiseBase { ...@@ -134,7 +132,7 @@ class TaskPromiseBase {
template <typename T> template <typename T>
friend class folly::coro::Task; friend class folly::coro::Task;
std::experimental::coroutine_handle<> continuation_; coroutine_handle<> continuation_;
folly::AsyncStackFrame asyncFrame_; folly::AsyncStackFrame asyncFrame_;
folly::Executor::KeepAlive<> executor_; folly::Executor::KeepAlive<> executor_;
folly::CancellationToken cancelToken_; folly::CancellationToken cancelToken_;
...@@ -258,7 +256,7 @@ class TaskPromise<void> : public TaskPromiseBase { ...@@ -258,7 +256,7 @@ class TaskPromise<void> : public TaskPromiseBase {
/// completes. /// completes.
template <typename T> template <typename T>
class FOLLY_NODISCARD TaskWithExecutor { class FOLLY_NODISCARD TaskWithExecutor {
using handle_t = std::experimental::coroutine_handle<detail::TaskPromise<T>>; using handle_t = coroutine_handle<detail::TaskPromise<T>>;
using StorageType = typename detail::TaskPromise<T>::StorageType; using StorageType = typename detail::TaskPromise<T>::StorageType;
public: public:
...@@ -402,7 +400,7 @@ class FOLLY_NODISCARD TaskWithExecutor { ...@@ -402,7 +400,7 @@ class FOLLY_NODISCARD TaskWithExecutor {
template <typename Promise> template <typename Promise>
FOLLY_NOINLINE void await_suspend( FOLLY_NOINLINE void await_suspend(
std::experimental::coroutine_handle<Promise> continuation) noexcept { coroutine_handle<Promise> continuation) noexcept {
DCHECK(coro_); DCHECK(coro_);
auto& promise = coro_.promise(); auto& promise = coro_.promise();
DCHECK(!promise.continuation_); DCHECK(!promise.continuation_);
...@@ -466,8 +464,8 @@ class FOLLY_NODISCARD TaskWithExecutor { ...@@ -466,8 +464,8 @@ class FOLLY_NODISCARD TaskWithExecutor {
bool await_ready() { return false; } bool await_ready() { return false; }
template <typename Promise> template <typename Promise>
FOLLY_NOINLINE std::experimental::coroutine_handle<> await_suspend( FOLLY_NOINLINE coroutine_handle<> await_suspend(
std::experimental::coroutine_handle<Promise> continuation) { coroutine_handle<Promise> continuation) {
DCHECK(coro_); DCHECK(coro_);
auto& promise = coro_.promise(); auto& promise = coro_.promise();
DCHECK(!promise.continuation_); DCHECK(!promise.continuation_);
...@@ -564,7 +562,7 @@ class FOLLY_NODISCARD Task { ...@@ -564,7 +562,7 @@ class FOLLY_NODISCARD Task {
private: private:
class Awaiter; class Awaiter;
using handle_t = std::experimental::coroutine_handle<promise_type>; using handle_t = coroutine_handle<promise_type>;
void setExecutor(folly::Executor::KeepAlive<>&& e) noexcept { void setExecutor(folly::Executor::KeepAlive<>&& e) noexcept {
DCHECK(coro_); DCHECK(coro_);
...@@ -665,7 +663,7 @@ class FOLLY_NODISCARD Task { ...@@ -665,7 +663,7 @@ class FOLLY_NODISCARD Task {
template <typename Promise> template <typename Promise>
FOLLY_NOINLINE auto await_suspend( FOLLY_NOINLINE auto await_suspend(
std::experimental::coroutine_handle<Promise> continuation) noexcept { coroutine_handle<Promise> continuation) noexcept {
DCHECK(coro_); DCHECK(coro_);
auto& promise = coro_.promise(); auto& promise = coro_.promise();
...@@ -742,14 +740,12 @@ Task<drop_unit_t<T>> makeResultTask(Try<T> t) { ...@@ -742,14 +740,12 @@ Task<drop_unit_t<T>> makeResultTask(Try<T> t) {
template <typename T> template <typename T>
Task<T> detail::TaskPromise<T>::get_return_object() noexcept { Task<T> detail::TaskPromise<T>::get_return_object() noexcept {
return Task<T>{ return Task<T>{coroutine_handle<detail::TaskPromise<T>>::from_promise(*this)};
std::experimental::coroutine_handle<detail::TaskPromise<T>>::from_promise(
*this)};
} }
inline Task<void> detail::TaskPromise<void>::get_return_object() noexcept { inline Task<void> detail::TaskPromise<void>::get_return_object() noexcept {
return Task<void>{std::experimental::coroutine_handle< return Task<void>{
detail::TaskPromise<void>>::from_promise(*this)}; coroutine_handle<detail::TaskPromise<void>>::from_promise(*this)};
} }
} // namespace coro } // namespace coro
......
...@@ -45,7 +45,7 @@ namespace detail { ...@@ -45,7 +45,7 @@ namespace detail {
template <typename T> template <typename T>
inline constexpr bool is_coroutine_handle_v = inline constexpr bool is_coroutine_handle_v =
folly::detail::is_instantiation_of_v< // folly::detail::is_instantiation_of_v< //
std::experimental::coroutine_handle, coroutine_handle,
T>; T>;
} // namespace detail } // namespace detail
...@@ -58,10 +58,10 @@ inline constexpr bool is_coroutine_handle_v = ...@@ -58,10 +58,10 @@ inline constexpr bool is_coroutine_handle_v =
/// ///
/// An 'Awaiter' must have the following three methods. /// An 'Awaiter' must have the following three methods.
/// - awaiter.await_ready() -> bool /// - awaiter.await_ready() -> bool
/// - awaiter.await_suspend(std::experimental::coroutine_handle<void>()) -> /// - awaiter.await_suspend(coroutine_handle<void>()) ->
/// void OR /// void OR
/// bool OR /// bool OR
/// std::experimental::coroutine_handle<T> for some T /// coroutine_handle<T> for some T
/// - awaiter.await_resume() /// - awaiter.await_resume()
/// ///
/// Note that we don't check for a valid await_suspend() method here since /// Note that we don't check for a valid await_suspend() method here since
......
...@@ -37,7 +37,7 @@ class AwaitableReady { ...@@ -37,7 +37,7 @@ class AwaitableReady {
bool await_ready() noexcept { return true; } bool await_ready() noexcept { return true; }
void await_suspend(std::experimental::coroutine_handle<>) noexcept {} void await_suspend(coroutine_handle<>) noexcept {}
T await_resume() noexcept(std::is_nothrow_move_constructible<T>::value) { T await_resume() noexcept(std::is_nothrow_move_constructible<T>::value) {
return static_cast<T&&>(value_); return static_cast<T&&>(value_);
...@@ -52,7 +52,7 @@ class AwaitableReady<void> { ...@@ -52,7 +52,7 @@ class AwaitableReady<void> {
public: public:
AwaitableReady() noexcept = default; AwaitableReady() noexcept = default;
bool await_ready() noexcept { return true; } bool await_ready() noexcept { return true; }
void await_suspend(std::experimental::coroutine_handle<>) noexcept {} void await_suspend(coroutine_handle<>) noexcept {}
void await_resume() noexcept {} void await_resume() noexcept {}
}; };
...@@ -60,9 +60,7 @@ namespace detail { ...@@ -60,9 +60,7 @@ namespace detail {
struct await_suspend_return_coroutine_fn { struct await_suspend_return_coroutine_fn {
template <typename A, typename P> template <typename A, typename P>
std::experimental::coroutine_handle<> operator()( coroutine_handle<> operator()(A& a, coroutine_handle<P> coro) const
A& a,
std::experimental::coroutine_handle<P> coro) const
noexcept(noexcept(a.await_suspend(coro))) { noexcept(noexcept(a.await_suspend(coro))) {
using result = decltype(a.await_suspend(coro)); using result = decltype(a.await_suspend(coro));
auto noop = std::experimental::noop_coroutine(); auto noop = std::experimental::noop_coroutine();
...@@ -84,9 +82,6 @@ class AwaitableVariant : private std::variant<A...> { ...@@ -84,9 +82,6 @@ class AwaitableVariant : private std::variant<A...> {
private: private:
using base = std::variant<A...>; using base = std::variant<A...>;
template <typename P = void>
using handle = std::experimental::coroutine_handle<P>;
template <typename Visitor> template <typename Visitor>
auto visit(Visitor v) { auto visit(Visitor v) {
return std::visit(v, static_cast<base&>(*this)); return std::visit(v, static_cast<base&>(*this));
...@@ -100,7 +95,7 @@ class AwaitableVariant : private std::variant<A...> { ...@@ -100,7 +95,7 @@ class AwaitableVariant : private std::variant<A...> {
return visit([&](auto& a) { return a.await_ready(); }); return visit([&](auto& a) { return a.await_ready(); });
} }
template <typename P> template <typename P>
auto await_suspend(handle<P> coro) noexcept( auto await_suspend(coroutine_handle<P> coro) noexcept(
(noexcept(FOLLY_DECLVAL(A&).await_suspend(coro)) && ...)) { (noexcept(FOLLY_DECLVAL(A&).await_suspend(coro)) && ...)) {
auto impl = await_suspend_return_coroutine; auto impl = await_suspend_return_coroutine;
return visit([&](auto& a) { return impl(a, coro); }); return visit([&](auto& a) { return impl(a, coro); });
......
...@@ -63,8 +63,7 @@ class ViaCoroutinePromiseBase { ...@@ -63,8 +63,7 @@ class ViaCoroutinePromiseBase {
executor_ = std::move(executor); executor_ = std::move(executor);
} }
void setContinuation( void setContinuation(coroutine_handle<> continuation) noexcept {
std::experimental::coroutine_handle<> continuation) noexcept {
continuation_ = continuation; continuation_ = continuation;
} }
...@@ -94,7 +93,7 @@ class ViaCoroutinePromiseBase { ...@@ -94,7 +93,7 @@ class ViaCoroutinePromiseBase {
protected: protected:
folly::Executor::KeepAlive<> executor_; folly::Executor::KeepAlive<> executor_;
std::experimental::coroutine_handle<> continuation_; coroutine_handle<> continuation_;
folly::AsyncStackFrame* asyncFrame_ = nullptr; folly::AsyncStackFrame* asyncFrame_ = nullptr;
std::shared_ptr<RequestContext> context_; std::shared_ptr<RequestContext> context_;
}; };
...@@ -107,7 +106,7 @@ class ViaCoroutine { ...@@ -107,7 +106,7 @@ class ViaCoroutine {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES void await_suspend( FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES void await_suspend(
std::experimental::coroutine_handle<promise_type> h) noexcept { coroutine_handle<promise_type> h) noexcept {
auto& promise = h.promise(); auto& promise = h.promise();
if (!promise.context_) { if (!promise.context_) {
promise.setRequestContext(RequestContext::saveContext()); promise.setRequestContext(RequestContext::saveContext());
...@@ -125,9 +124,7 @@ class ViaCoroutine { ...@@ -125,9 +124,7 @@ class ViaCoroutine {
public: public:
ViaCoroutine get_return_object() noexcept { ViaCoroutine get_return_object() noexcept {
return ViaCoroutine{ return ViaCoroutine{coroutine_handle<promise_type>::from_promise(*this)};
std::experimental::coroutine_handle<promise_type>::from_promise(
*this)};
} }
FinalAwaiter final_suspend() noexcept { return {}; } FinalAwaiter final_suspend() noexcept { return {}; }
...@@ -160,8 +157,7 @@ class ViaCoroutine { ...@@ -160,8 +157,7 @@ class ViaCoroutine {
coro_.promise().setExecutor(std::move(executor)); coro_.promise().setExecutor(std::move(executor));
} }
void setContinuation( void setContinuation(coroutine_handle<> continuation) noexcept {
std::experimental::coroutine_handle<> continuation) noexcept {
coro_.promise().setContinuation(continuation); coro_.promise().setContinuation(continuation);
} }
...@@ -179,18 +175,15 @@ class ViaCoroutine { ...@@ -179,18 +175,15 @@ class ViaCoroutine {
coro_.promise().setRequestContext(folly::RequestContext::saveContext()); coro_.promise().setRequestContext(folly::RequestContext::saveContext());
} }
std::experimental::coroutine_handle<promise_type> getHandle() noexcept { coroutine_handle<promise_type> getHandle() noexcept { return coro_; }
return coro_;
}
private: private:
explicit ViaCoroutine( explicit ViaCoroutine(coroutine_handle<promise_type> coro) noexcept
std::experimental::coroutine_handle<promise_type> coro) noexcept
: coro_(coro) {} : coro_(coro) {}
static ViaCoroutine createImpl() { co_return; } static ViaCoroutine createImpl() { co_return; }
std::experimental::coroutine_handle<promise_type> coro_; coroutine_handle<promise_type> coro_;
}; };
} // namespace detail } // namespace detail
...@@ -202,7 +195,7 @@ class StackAwareViaIfAsyncAwaiter { ...@@ -202,7 +195,7 @@ class StackAwareViaIfAsyncAwaiter {
using Awaiter = folly::coro::awaiter_type_t<WithAsyncStackAwaitable>; using Awaiter = folly::coro::awaiter_type_t<WithAsyncStackAwaitable>;
using CoroutineType = detail::ViaCoroutine<true>; using CoroutineType = detail::ViaCoroutine<true>;
using CoroutinePromise = typename CoroutineType::promise_type; using CoroutinePromise = typename CoroutineType::promise_type;
using WrapperHandle = std::experimental::coroutine_handle<CoroutinePromise>; using WrapperHandle = coroutine_handle<CoroutinePromise>;
using await_suspend_result_t = decltype( using await_suspend_result_t = decltype(
std::declval<Awaiter&>().await_suspend(std::declval<WrapperHandle>())); std::declval<Awaiter&>().await_suspend(std::declval<WrapperHandle>()));
...@@ -222,9 +215,9 @@ class StackAwareViaIfAsyncAwaiter { ...@@ -222,9 +215,9 @@ class StackAwareViaIfAsyncAwaiter {
} }
template <typename Promise> template <typename Promise>
auto await_suspend(std::experimental::coroutine_handle<Promise> h) noexcept( auto await_suspend(coroutine_handle<Promise> h) noexcept(noexcept(
noexcept(std::declval<Awaiter&>().await_suspend( std::declval<Awaiter&>().await_suspend(std::declval<WrapperHandle>())))
std::declval<WrapperHandle>()))) -> await_suspend_result_t { -> await_suspend_result_t {
auto& promise = h.promise(); auto& promise = h.promise();
auto& asyncFrame = promise.getAsyncFrame(); auto& asyncFrame = promise.getAsyncFrame();
...@@ -263,7 +256,7 @@ class ViaIfAsyncAwaiter { ...@@ -263,7 +256,7 @@ class ViaIfAsyncAwaiter {
using Awaiter = folly::coro::awaiter_type_t<Awaitable>; using Awaiter = folly::coro::awaiter_type_t<Awaitable>;
using CoroutineType = detail::ViaCoroutine<false>; using CoroutineType = detail::ViaCoroutine<false>;
using CoroutinePromise = typename CoroutineType::promise_type; using CoroutinePromise = typename CoroutineType::promise_type;
using WrapperHandle = std::experimental::coroutine_handle<CoroutinePromise>; using WrapperHandle = coroutine_handle<CoroutinePromise>;
using await_suspend_result_t = decltype( using await_suspend_result_t = decltype(
std::declval<Awaiter&>().await_suspend(std::declval<WrapperHandle>())); std::declval<Awaiter&>().await_suspend(std::declval<WrapperHandle>()));
...@@ -309,11 +302,8 @@ class ViaIfAsyncAwaiter { ...@@ -309,11 +302,8 @@ class ViaIfAsyncAwaiter {
// case. // case.
template <typename Promise> template <typename Promise>
auto await_suspend( auto await_suspend(coroutine_handle<Promise> continuation) noexcept(
std::experimental::coroutine_handle<Promise> noexcept(awaiter_.await_suspend(std::declval<WrapperHandle>())))
continuation) noexcept(noexcept(awaiter_
.await_suspend(std::declval<
WrapperHandle>())))
-> await_suspend_result_t { -> await_suspend_result_t {
viaCoroutine_.setContinuation(continuation); viaCoroutine_.setContinuation(continuation);
...@@ -520,8 +510,7 @@ class TryAwaiter { ...@@ -520,8 +510,7 @@ class TryAwaiter {
} }
template <typename Promise> template <typename Promise>
auto auto await_suspend(coroutine_handle<Promise> coro) noexcept(
await_suspend(std::experimental::coroutine_handle<Promise> coro) noexcept(
noexcept(std::declval<Awaiter&>().await_suspend(coro))) noexcept(std::declval<Awaiter&>().await_suspend(coro)))
-> decltype(std::declval<Awaiter&>().await_suspend(coro)) { -> decltype(std::declval<Awaiter&>().await_suspend(coro)) {
return awaiter_.await_suspend(coro); return awaiter_.await_suspend(coro);
......
...@@ -39,16 +39,14 @@ class WithAsyncStackCoroutine { ...@@ -39,16 +39,14 @@ class WithAsyncStackCoroutine {
public: public:
WithAsyncStackCoroutine get_return_object() noexcept { WithAsyncStackCoroutine get_return_object() noexcept {
return WithAsyncStackCoroutine{ return WithAsyncStackCoroutine{
std::experimental::coroutine_handle<promise_type>::from_promise( coroutine_handle<promise_type>::from_promise(*this)};
*this)};
} }
suspend_always initial_suspend() noexcept { return {}; } suspend_always initial_suspend() noexcept { return {}; }
struct FinalAwaiter { struct FinalAwaiter {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
void await_suspend( void await_suspend(coroutine_handle<promise_type> h) noexcept {
std::experimental::coroutine_handle<promise_type> h) noexcept {
auto& promise = h.promise(); auto& promise = h.promise();
folly::resumeCoroutineWithNewAsyncStackRoot( folly::resumeCoroutineWithNewAsyncStackRoot(
promise.continuation_, *promise.parentFrame_); promise.continuation_, *promise.parentFrame_);
...@@ -68,7 +66,7 @@ class WithAsyncStackCoroutine { ...@@ -68,7 +66,7 @@ class WithAsyncStackCoroutine {
private: private:
friend WithAsyncStackCoroutine; friend WithAsyncStackCoroutine;
std::experimental::coroutine_handle<> continuation_; coroutine_handle<> continuation_;
folly::AsyncStackFrame* parentFrame_ = nullptr; folly::AsyncStackFrame* parentFrame_ = nullptr;
}; };
...@@ -91,8 +89,8 @@ class WithAsyncStackCoroutine { ...@@ -91,8 +89,8 @@ class WithAsyncStackCoroutine {
static WithAsyncStackCoroutine create() { co_return; } static WithAsyncStackCoroutine create() { co_return; }
template <typename Promise> template <typename Promise>
std::experimental::coroutine_handle<promise_type> getWrapperHandleFor( coroutine_handle<promise_type> getWrapperHandleFor(
std::experimental::coroutine_handle<Promise> h) noexcept { coroutine_handle<Promise> h) noexcept {
auto& promise = coro_.promise(); auto& promise = coro_.promise();
promise.continuation_ = h; promise.continuation_ = h;
promise.parentFrame_ = std::addressof(h.promise().getAsyncFrame()); promise.parentFrame_ = std::addressof(h.promise().getAsyncFrame());
...@@ -100,11 +98,10 @@ class WithAsyncStackCoroutine { ...@@ -100,11 +98,10 @@ class WithAsyncStackCoroutine {
} }
private: private:
explicit WithAsyncStackCoroutine( explicit WithAsyncStackCoroutine(coroutine_handle<promise_type> h) noexcept
std::experimental::coroutine_handle<promise_type> h) noexcept
: coro_(h) {} : coro_(h) {}
std::experimental::coroutine_handle<promise_type> coro_; coroutine_handle<promise_type> coro_;
}; };
template <typename Awaitable> template <typename Awaitable>
...@@ -123,7 +120,7 @@ class WithAsyncStackAwaiter { ...@@ -123,7 +120,7 @@ class WithAsyncStackAwaiter {
template <typename Promise> template <typename Promise>
FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES auto await_suspend( FOLLY_CORO_AWAIT_SUSPEND_NONTRIVIAL_ATTRIBUTES auto await_suspend(
std::experimental::coroutine_handle<Promise> h) { coroutine_handle<Promise> h) {
AsyncStackFrame& callerFrame = h.promise().getAsyncFrame(); AsyncStackFrame& callerFrame = h.promise().getAsyncFrame();
AsyncStackRoot* stackRoot = callerFrame.getStackRoot(); AsyncStackRoot* stackRoot = callerFrame.getStackRoot();
assert(stackRoot != nullptr); assert(stackRoot != nullptr);
......
...@@ -63,7 +63,7 @@ class Barrier { ...@@ -63,7 +63,7 @@ class Barrier {
return count_.load(std::memory_order_acquire); return count_.load(std::memory_order_acquire);
} }
[[nodiscard]] std::experimental::coroutine_handle<> arrive( [[nodiscard]] coroutine_handle<> arrive(
folly::AsyncStackFrame& currentFrame) noexcept { folly::AsyncStackFrame& currentFrame) noexcept {
auto& stackRoot = *currentFrame.getStackRoot(); auto& stackRoot = *currentFrame.getStackRoot();
folly::deactivateAsyncStackFrame(currentFrame); folly::deactivateAsyncStackFrame(currentFrame);
...@@ -84,7 +84,7 @@ class Barrier { ...@@ -84,7 +84,7 @@ class Barrier {
} }
} }
[[nodiscard]] std::experimental::coroutine_handle<> arrive() noexcept { [[nodiscard]] coroutine_handle<> arrive() noexcept {
const std::size_t oldCount = count_.fetch_sub(1, std::memory_order_acq_rel); const std::size_t oldCount = count_.fetch_sub(1, std::memory_order_acq_rel);
// Invalid to call arrive() if you haven't previously incremented the // Invalid to call arrive() if you haven't previously incremented the
...@@ -112,8 +112,8 @@ class Barrier { ...@@ -112,8 +112,8 @@ class Barrier {
bool await_ready() { return false; } bool await_ready() { return false; }
template <typename Promise> template <typename Promise>
std::experimental::coroutine_handle<> await_suspend( coroutine_handle<> await_suspend(
std::experimental::coroutine_handle<Promise> continuation) noexcept { coroutine_handle<Promise> continuation) noexcept {
if constexpr (detail::promiseHasAsyncFrame_v<Promise>) { if constexpr (detail::promiseHasAsyncFrame_v<Promise>) {
barrier_.setContinuation( barrier_.setContinuation(
continuation, &continuation.promise().getAsyncFrame()); continuation, &continuation.promise().getAsyncFrame());
...@@ -140,7 +140,7 @@ class Barrier { ...@@ -140,7 +140,7 @@ class Barrier {
auto arriveAndWait() noexcept { return Awaiter{*this}; } auto arriveAndWait() noexcept { return Awaiter{*this}; }
void setContinuation( void setContinuation(
std::experimental::coroutine_handle<> continuation, coroutine_handle<> continuation,
folly::AsyncStackFrame* parentFrame) noexcept { folly::AsyncStackFrame* parentFrame) noexcept {
assert(!continuation_); assert(!continuation_);
continuation_ = continuation; continuation_ = continuation;
...@@ -149,7 +149,7 @@ class Barrier { ...@@ -149,7 +149,7 @@ class Barrier {
private: private:
std::atomic<std::size_t> count_; std::atomic<std::size_t> count_;
std::experimental::coroutine_handle<> continuation_; coroutine_handle<> continuation_;
folly::AsyncStackFrame* asyncFrame_ = nullptr; folly::AsyncStackFrame* asyncFrame_ = nullptr;
}; };
......
...@@ -36,8 +36,8 @@ class BarrierTask { ...@@ -36,8 +36,8 @@ class BarrierTask {
struct FinalAwaiter { struct FinalAwaiter {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
std::experimental::coroutine_handle<> await_suspend( coroutine_handle<> await_suspend(
std::experimental::coroutine_handle<promise_type> h) noexcept { coroutine_handle<promise_type> h) noexcept {
auto& promise = h.promise(); auto& promise = h.promise();
assert(promise.barrier_ != nullptr); assert(promise.barrier_ != nullptr);
return promise.barrier_->arrive(promise.asyncFrame_); return promise.barrier_->arrive(promise.asyncFrame_);
...@@ -56,9 +56,7 @@ class BarrierTask { ...@@ -56,9 +56,7 @@ class BarrierTask {
} }
BarrierTask get_return_object() noexcept { BarrierTask get_return_object() noexcept {
return BarrierTask{ return BarrierTask{coroutine_handle<promise_type>::from_promise(*this)};
std::experimental::coroutine_handle<promise_type>::from_promise(
*this)};
} }
suspend_always initial_suspend() noexcept { return {}; } suspend_always initial_suspend() noexcept { return {}; }
...@@ -88,7 +86,7 @@ class BarrierTask { ...@@ -88,7 +86,7 @@ class BarrierTask {
}; };
private: private:
using handle_t = std::experimental::coroutine_handle<promise_type>; using handle_t = coroutine_handle<promise_type>;
explicit BarrierTask(handle_t coro) noexcept : coro_(coro) {} explicit BarrierTask(handle_t coro) noexcept : coro_(coro) {}
...@@ -139,8 +137,7 @@ class DetachedBarrierTask { ...@@ -139,8 +137,7 @@ class DetachedBarrierTask {
DetachedBarrierTask get_return_object() noexcept { DetachedBarrierTask get_return_object() noexcept {
return DetachedBarrierTask{ return DetachedBarrierTask{
std::experimental::coroutine_handle<promise_type>::from_promise( coroutine_handle<promise_type>::from_promise(*this)};
*this)};
} }
suspend_always initial_suspend() noexcept { return {}; } suspend_always initial_suspend() noexcept { return {}; }
...@@ -148,8 +145,7 @@ class DetachedBarrierTask { ...@@ -148,8 +145,7 @@ class DetachedBarrierTask {
auto final_suspend() noexcept { auto final_suspend() noexcept {
struct awaiter { struct awaiter {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
auto await_suspend( auto await_suspend(coroutine_handle<promise_type> h) noexcept {
std::experimental::coroutine_handle<promise_type> h) noexcept {
assert(h.promise().barrier_ != nullptr); assert(h.promise().barrier_ != nullptr);
auto continuation = auto continuation =
h.promise().barrier_->arrive(h.promise().getAsyncFrame()); h.promise().barrier_->arrive(h.promise().getAsyncFrame());
...@@ -181,7 +177,7 @@ class DetachedBarrierTask { ...@@ -181,7 +177,7 @@ class DetachedBarrierTask {
}; };
private: private:
using handle_t = std::experimental::coroutine_handle<promise_type>; using handle_t = coroutine_handle<promise_type>;
explicit DetachedBarrierTask(handle_t coro) : coro_(coro) {} explicit DetachedBarrierTask(handle_t coro) : coro_(coro) {}
......
...@@ -41,8 +41,7 @@ class CurrentAsyncStackFrameAwaitable { ...@@ -41,8 +41,7 @@ class CurrentAsyncStackFrameAwaitable {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
template <typename Promise> template <typename Promise>
bool await_suspend( bool await_suspend(coroutine_handle<Promise> h) noexcept {
std::experimental::coroutine_handle<Promise> h) noexcept {
asyncFrame_ = &h.promise().getAsyncFrame(); asyncFrame_ = &h.promise().getAsyncFrame();
return false; return false;
} }
......
...@@ -53,8 +53,7 @@ class InlineTaskPromiseBase { ...@@ -53,8 +53,7 @@ class InlineTaskPromiseBase {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
template <typename Promise> template <typename Promise>
std::experimental::coroutine_handle<> await_suspend( coroutine_handle<> await_suspend(coroutine_handle<Promise> h) noexcept {
std::experimental::coroutine_handle<Promise> h) noexcept {
InlineTaskPromiseBase& promise = h.promise(); InlineTaskPromiseBase& promise = h.promise();
return promise.continuation_; return promise.continuation_;
} }
...@@ -83,14 +82,13 @@ class InlineTaskPromiseBase { ...@@ -83,14 +82,13 @@ class InlineTaskPromiseBase {
auto final_suspend() noexcept { return FinalAwaiter{}; } auto final_suspend() noexcept { return FinalAwaiter{}; }
void set_continuation( void set_continuation(coroutine_handle<> continuation) noexcept {
std::experimental::coroutine_handle<> continuation) noexcept {
assert(!continuation_); assert(!continuation_);
continuation_ = continuation; continuation_ = continuation;
} }
private: private:
std::experimental::coroutine_handle<> continuation_; coroutine_handle<> continuation_;
}; };
template <typename T> template <typename T>
...@@ -168,7 +166,7 @@ class InlineTask { ...@@ -168,7 +166,7 @@ class InlineTask {
using promise_type = detail::InlineTaskPromise<T>; using promise_type = detail::InlineTaskPromise<T>;
private: private:
using handle_t = std::experimental::coroutine_handle<promise_type>; using handle_t = coroutine_handle<promise_type>;
public: public:
InlineTask(InlineTask&& other) noexcept InlineTask(InlineTask&& other) noexcept
...@@ -190,8 +188,7 @@ class InlineTask { ...@@ -190,8 +188,7 @@ class InlineTask {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
handle_t await_suspend( handle_t await_suspend(coroutine_handle<> awaitingCoroutine) noexcept {
std::experimental::coroutine_handle<> awaitingCoroutine) noexcept {
assert(coro_ && !coro_.done()); assert(coro_ && !coro_.done());
coro_.promise().set_continuation(awaitingCoroutine); coro_.promise().set_continuation(awaitingCoroutine);
return coro_; return coro_;
...@@ -223,13 +220,12 @@ class InlineTask { ...@@ -223,13 +220,12 @@ class InlineTask {
template <typename T> template <typename T>
inline InlineTask<T> InlineTaskPromise<T>::get_return_object() noexcept { inline InlineTask<T> InlineTaskPromise<T>::get_return_object() noexcept {
return InlineTask<T>{ return InlineTask<T>{
std::experimental::coroutine_handle<InlineTaskPromise<T>>::from_promise( coroutine_handle<InlineTaskPromise<T>>::from_promise(*this)};
*this)};
} }
inline InlineTask<void> InlineTaskPromise<void>::get_return_object() noexcept { inline InlineTask<void> InlineTaskPromise<void>::get_return_object() noexcept {
return InlineTask<void>{std::experimental::coroutine_handle< return InlineTask<void>{
InlineTaskPromise<void>>::from_promise(*this)}; coroutine_handle<InlineTaskPromise<void>>::from_promise(*this)};
} }
/// InlineTaskDetached is a coroutine-return type where the coroutine is /// InlineTaskDetached is a coroutine-return type where the coroutine is
...@@ -248,8 +244,7 @@ struct InlineTaskDetached { ...@@ -248,8 +244,7 @@ struct InlineTaskDetached {
class promise_type { class promise_type {
struct FinalAwaiter { struct FinalAwaiter {
bool await_ready() noexcept { return false; } bool await_ready() noexcept { return false; }
void await_suspend( void await_suspend(coroutine_handle<promise_type> h) noexcept {
std::experimental::coroutine_handle<promise_type> h) noexcept {
folly::deactivateAsyncStackFrame(h.promise().getAsyncFrame()); folly::deactivateAsyncStackFrame(h.promise().getAsyncFrame());
h.destroy(); h.destroy();
} }
...@@ -271,8 +266,7 @@ struct InlineTaskDetached { ...@@ -271,8 +266,7 @@ struct InlineTaskDetached {
InlineTaskDetached get_return_object() noexcept { InlineTaskDetached get_return_object() noexcept {
return InlineTaskDetached{ return InlineTaskDetached{
std::experimental::coroutine_handle<promise_type>::from_promise( coroutine_handle<promise_type>::from_promise(*this)};
*this)};
} }
suspend_always initial_suspend() noexcept { return {}; } suspend_always initial_suspend() noexcept { return {}; }
...@@ -314,11 +308,10 @@ struct InlineTaskDetached { ...@@ -314,11 +308,10 @@ struct InlineTaskDetached {
} }
private: private:
explicit InlineTaskDetached( explicit InlineTaskDetached(coroutine_handle<promise_type> h) noexcept
std::experimental::coroutine_handle<promise_type> h) noexcept
: coro_(h) {} : coro_(h) {}
std::experimental::coroutine_handle<promise_type> coro_; coroutine_handle<promise_type> coro_;
}; };
} // namespace detail } // namespace detail
......
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