Commit ff3c5f9c authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Tweaks to Futures after D9015012

Summary:
[Folly] Tweaks to Futures after {D9015012}.

* Publish base-class methods with `using`.
* Use trailing-comma in list initializers.

Reviewed By: shixiao

Differential Revision: D9024885

fbshipit-source-id: d1e548630152a7d7ce892084daef24a4e62dd0df
parent a31665e0
...@@ -550,6 +550,7 @@ class SemiFuture : private futures::detail::FutureBase<T> { ...@@ -550,6 +550,7 @@ class SemiFuture : private futures::detail::FutureBase<T> {
/* implicit */ SemiFuture(Future<T>&&) noexcept; /* implicit */ SemiFuture(Future<T>&&) noexcept;
using Base::cancel; using Base::cancel;
using Base::getPriority;
using Base::hasException; using Base::hasException;
using Base::hasValue; using Base::hasValue;
using Base::isReady; using Base::isReady;
...@@ -839,11 +840,6 @@ class SemiFuture : private futures::detail::FutureBase<T> { ...@@ -839,11 +840,6 @@ class SemiFuture : private futures::detail::FutureBase<T> {
/// - `RESULT.valid() == true` /// - `RESULT.valid() == true`
Future<T> toUnsafeFuture() &&; Future<T> toUnsafeFuture() &&;
/// Return this future's executor priority.
int8_t getPriority() const {
return Base::getPriority();
}
#if FOLLY_HAS_COROUTINES #if FOLLY_HAS_COROUTINES
class promise_type { class promise_type {
public: public:
...@@ -1039,15 +1035,16 @@ class Future : private futures::detail::FutureBase<T> { ...@@ -1039,15 +1035,16 @@ class Future : private futures::detail::FutureBase<T> {
Future& operator=(Future<T2>&&); Future& operator=(Future<T2>&&);
using Base::cancel; using Base::cancel;
using Base::getPriority;
using Base::hasException; using Base::hasException;
using Base::hasValue; using Base::hasValue;
using Base::isReady; using Base::isReady;
using Base::poll; using Base::poll;
using Base::raise; using Base::raise;
using Base::result;
using Base::setCallback_; using Base::setCallback_;
using Base::valid; using Base::valid;
using Base::value; using Base::value;
using Base::result;
/// Creates/returns an invalid Future, that is, one with no shared state. /// Creates/returns an invalid Future, that is, one with no shared state.
/// ///
...@@ -1822,11 +1819,6 @@ class Future : private futures::detail::FutureBase<T> { ...@@ -1822,11 +1819,6 @@ class Future : private futures::detail::FutureBase<T> {
return SemiFuture<T>{std::move(*this)}; return SemiFuture<T>{std::move(*this)};
} }
// Returns this future's executor priority.
int8_t getPriority() const {
return Base::getPriority();
}
protected: protected:
friend class Promise<T>; friend class Promise<T>;
template <class> template <class>
......
...@@ -176,9 +176,11 @@ TEST(FutureSplitter, splitFutureFailure) { ...@@ -176,9 +176,11 @@ TEST(FutureSplitter, splitFutureFailure) {
} }
TEST(FutureSplitter, splitFuturePriority) { TEST(FutureSplitter, splitFuturePriority) {
std::vector<int8_t> priorities = {folly::Executor::LO_PRI, std::vector<int8_t> priorities = {
folly::Executor::MID_PRI, folly::Executor::LO_PRI,
folly::Executor::HI_PRI}; folly::Executor::MID_PRI,
folly::Executor::HI_PRI,
};
for (const auto priority : priorities) { for (const auto priority : priorities) {
Promise<int> p; Promise<int> p;
......
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