From: Lee Howes Date: Wed, 27 Dec 2017 04:31:33 +0000 (-0800) Subject: Add deprecation comments to folly::makeFuture. X-Git-Tag: v2018.01.01.00~11 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=7acba7e1a0a75d22087647b3e9e830c9b0e8d41e 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 --- diff --git a/folly/futures/helpers.h b/folly/futures/helpers.h index 9b5e85ba..eb5412b2 100644 --- a/folly/futures/helpers.h +++ b/folly/futures/helpers.h @@ -186,11 +186,21 @@ SemiFuture makeSemiFuture(Try&& t); or auto f = makeFuture("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 Future::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 makeFuture(); /** @@ -208,6 +218,10 @@ Future makeFuture(); Calling makeFutureWith(func) is equivalent to calling 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()) -> Future @@ -229,21 +243,35 @@ makeFutureWith(F&& func); /// /// auto f = makeFuture(std::current_exception()); template -FOLLY_DEPRECATED("use makeFuture(exception_wrapper)") +FOLLY_DEPRECATED("use makeSemiFuture(exception_wrapper)") Future makeFuture(std::exception_ptr const& e); /// 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 Future makeFuture(exception_wrapper ew); /** 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 typename std::enable_if::value, Future>::type 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 Future makeFuture(Try&& t);