Commit bdb2a715 authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook Github Bot

Simplify DeferredExecutor

Summary: Move the wait() and timed_wait() functionality out of DeferredExecutor. This is now possible because folly::Futures are using Executor::KeepAlive to manage executors' life-time.

Reviewed By: LeeHowes

Differential Revision: D9925417

fbshipit-source-id: e9818417048f44ee66648439e781060fdabca6b9
parent e3f27085
This diff is collapsed.
...@@ -447,7 +447,8 @@ template <typename T> ...@@ -447,7 +447,8 @@ template <typename T>
DeferredExecutor* getDeferredExecutor(SemiFuture<T>& future); DeferredExecutor* getDeferredExecutor(SemiFuture<T>& future);
template <typename T> template <typename T>
DeferredExecutor* stealDeferredExecutor(SemiFuture<T>& future); folly::Executor::KeepAlive<DeferredExecutor> stealDeferredExecutor(
SemiFuture<T>& future);
} // namespace detail } // namespace detail
} // namespace futures } // namespace futures
...@@ -876,8 +877,8 @@ class SemiFuture : private futures::detail::FutureBase<T> { ...@@ -876,8 +877,8 @@ class SemiFuture : private futures::detail::FutureBase<T> {
friend class SemiFuture; friend class SemiFuture;
template <class> template <class>
friend class Future; friend class Future;
friend DeferredExecutor* futures::detail::stealDeferredExecutor<T>( friend folly::Executor::KeepAlive<DeferredExecutor>
SemiFuture&); futures::detail::stealDeferredExecutor<T>(SemiFuture&);
friend DeferredExecutor* futures::detail::getDeferredExecutor<T>(SemiFuture&); friend DeferredExecutor* futures::detail::getDeferredExecutor<T>(SemiFuture&);
using Base::setExecutor; using Base::setExecutor;
...@@ -896,7 +897,7 @@ class SemiFuture : private futures::detail::FutureBase<T> { ...@@ -896,7 +897,7 @@ class SemiFuture : private futures::detail::FutureBase<T> {
DeferredExecutor* getDeferredExecutor() const; DeferredExecutor* getDeferredExecutor() const;
// Throws FutureInvalid if !this->core_ // Throws FutureInvalid if !this->core_
DeferredExecutor* stealDeferredExecutor() const; folly::Executor::KeepAlive<DeferredExecutor> stealDeferredExecutor() const;
/// Blocks until the future is fulfilled, or `dur` elapses. /// Blocks until the future is fulfilled, or `dur` elapses.
/// ///
......
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