Commit 8828dd94 authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Remove nullary continuation form of Future::then

Summary:
Remove the form of Future::then that could take a continuation with no parameters from elsewhere in Future.h as it is deprecated, and pending deletion.

In particular this required splitting the multi forms of the functions which still allow flexible typing at this point in time.

Reviewed By: yfeldblum

Differential Revision: D10206118

fbshipit-source-id: bb2ae241d3bfd5b89cae077e667cb39c4cc62797
parent 76c6b656
......@@ -1238,16 +1238,26 @@ class Future : private futures::detail::FutureBase<T> {
/// - Calling code should act as if `valid() == false`,
/// i.e., as if `*this` was moved into RESULT.
/// - `RESULT.valid() == true`
template <class Arg, class... Args>
auto then(Executor* x, Arg&& arg, Args&&... args) && {
template <class Arg>
auto then(Executor* x, Arg&& arg) && {
auto oldX = this->getExecutor();
this->setExecutor(x);
FOLLY_PUSH_WARNING
FOLLY_GNU_DISABLE_WARNING("-Wdeprecated-declarations")
// TODO(T29171940): thenImplementation here is ambiguous
// as then used to be but that is better than keeping then in the public
// API.
using R = futures::detail::callableResult<T, Arg&&>;
return std::move(*this)
.then(std::forward<Arg>(arg), std::forward<Args>(args)...)
.thenImplementation(std::forward<Arg>(arg), R{})
.via(oldX);
FOLLY_POP_WARNING
}
template <class R, class Caller, class... Args>
auto then(Executor* x, R (Caller::*func)(Args...), Caller* instance) && {
auto oldX = this->getExecutor();
this->setExecutor(x);
return std::move(*this).then(func, instance).via(oldX);
}
template <class Arg, class... Args>
......@@ -1809,8 +1819,13 @@ class Future : private futures::detail::FutureBase<T> {
template <class Callback, class... Callbacks>
auto thenMulti(Callback&& fn, Callbacks&&... fns) && {
// thenMulti with two callbacks is just then(a).thenMulti(b, ...)
// TODO(T29171940): Switch to thenImplementation here. It is ambiguous
// as then used to be but that is better than keeping then in the public
// API.
using R = futures::detail::callableResult<T, decltype(fn)>;
return std::move(*this)
.then(std::forward<Callback>(fn))
.thenImplementation(std::forward<Callback>(fn), R{})
.thenMulti(std::forward<Callbacks>(fns)...);
}
......@@ -1828,7 +1843,12 @@ class Future : private futures::detail::FutureBase<T> {
template <class Callback>
auto thenMulti(Callback&& fn) && {
// thenMulti with one callback is just a then
return std::move(*this).then(std::forward<Callback>(fn));
// TODO(T29171940): Switch to thenImplementation here. It is ambiguous
// as then used to be but that is better than keeping then in the public
// API.
using R = futures::detail::callableResult<T, decltype(fn)>;
return std::move(*this).thenImplementation(std::forward<Callback>(fn), R{});
}
template <class Callback>
......@@ -1861,8 +1881,12 @@ class Future : private futures::detail::FutureBase<T> {
// via(x).then(a).thenMulti(b, ...).via(oldX)
auto oldX = this->getExecutor();
this->setExecutor(x);
// TODO(T29171940): Switch to thenImplementation here. It is ambiguous
// as then used to be but that is better than keeping then in the public
// API.
using R = futures::detail::callableResult<T, decltype(fn)>;
return std::move(*this)
.then(std::forward<Callback>(fn))
.thenImplementation(std::forward<Callback>(fn), R{})
.thenMulti(std::forward<Callbacks>(fns)...)
.via(oldX);
}
......
......@@ -181,7 +181,7 @@ retryingPolicyCappedJitteredExponentialBackoff(
}
auto backoff = detail::retryingJitteredExponentialBackoffDur(
n, backoff_min, backoff_max, jitter_param, rngp);
return futures::sleep(backoff).then([] { return true; });
return futures::sleep(backoff).thenValue([](auto&&) { return true; });
});
};
}
......
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