Commit 7acba7e1 authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Add deprecation comments to folly::makeFuture.

Summary:
To ensure that we do not end up with continuable futures without attached executors we should deprecate folly::makeFuture. In most cases folly::makeSemiFuture is adequate here.

This diff only adds comments to dissuade future use.

Reviewed By: yfeldblum

Differential Revision: D6628800

fbshipit-source-id: c2b91df351cc5980c1bfb752f7536d320ef8168a
parent a5b53283
...@@ -186,11 +186,21 @@ SemiFuture<T> makeSemiFuture(Try<T>&& t); ...@@ -186,11 +186,21 @@ SemiFuture<T> makeSemiFuture(Try<T>&& t);
or or
auto f = makeFuture<string>("foo"); auto f = makeFuture<string>("foo");
NOTE: This function is deprecated. Please use makeSemiFuture and pass the
appropriate executor to .via on the returned SemiFuture to get a
valid Future where necessary.
*/ */
template <class T> template <class T>
Future<typename std::decay<T>::type> makeFuture(T&& t); Future<typename std::decay<T>::type> makeFuture(T&& t);
/** Make a completed void Future. */ /**
Make a completed void Future.
NOTE: This function is deprecated. Please use makeSemiFuture and pass the
appropriate executor to .via on the returned SemiFuture to get a
valid Future where necessary.
*/
Future<Unit> makeFuture(); Future<Unit> makeFuture();
/** /**
...@@ -208,6 +218,10 @@ Future<Unit> makeFuture(); ...@@ -208,6 +218,10 @@ Future<Unit> makeFuture();
Calling makeFutureWith(func) is equivalent to calling Calling makeFutureWith(func) is equivalent to calling
makeFuture().then(func). makeFuture().then(func).
NOTE: This function is deprecated. Please use makeSemiFutureWith and pass the
appropriate executor to .via on the returned SemiFuture to get a
valid Future where necessary.
*/ */
// makeFutureWith(Future<T>()) -> Future<T> // makeFutureWith(Future<T>()) -> Future<T>
...@@ -229,21 +243,35 @@ makeFutureWith(F&& func); ...@@ -229,21 +243,35 @@ makeFutureWith(F&& func);
/// ///
/// auto f = makeFuture<string>(std::current_exception()); /// auto f = makeFuture<string>(std::current_exception());
template <class T> template <class T>
FOLLY_DEPRECATED("use makeFuture(exception_wrapper)") FOLLY_DEPRECATED("use makeSemiFuture(exception_wrapper)")
Future<T> makeFuture(std::exception_ptr const& e); Future<T> makeFuture(std::exception_ptr const& e);
/// Make a failed Future from an exception_wrapper. /// Make a failed Future from an exception_wrapper.
/// NOTE: This function is deprecated. Please use makeSemiFuture and pass the
/// appropriate executor to .via on the returned SemiFuture to get a
/// valid Future where necessary.
template <class T> template <class T>
Future<T> makeFuture(exception_wrapper ew); Future<T> makeFuture(exception_wrapper ew);
/** Make a Future from an exception type E that can be passed to /** Make a Future from an exception type E that can be passed to
std::make_exception_ptr(). */ std::make_exception_ptr().
NOTE: This function is deprecated. Please use makeSemiFuture and pass the
appropriate executor to .via on the returned SemiFuture to get a
valid Future where necessary.
*/
template <class T, class E> template <class T, class E>
typename std::enable_if<std::is_base_of<std::exception, E>::value, typename std::enable_if<std::is_base_of<std::exception, E>::value,
Future<T>>::type Future<T>>::type
makeFuture(E const& e); makeFuture(E const& e);
/** Make a Future out of a Try */ /**
Make a Future out of a Try
NOTE: This function is deprecated. Please use makeSemiFuture and pass the
appropriate executor to .via on the returned SemiFuture to get a
valid Future where necessary.
*/
template <class T> template <class T>
Future<T> makeFuture(Try<T>&& t); Future<T> makeFuture(Try<T>&& t);
......
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