#include <folly/Utility.h>
#include <folly/futures/FutureException.h>
#include <folly/futures/detail/FSM.h>
+#include <folly/portability/BitsFunctexcept.h>
#include <folly/io/async/Request.h>
-namespace folly { namespace detail {
+namespace folly {
+namespace futures {
+namespace detail {
/*
OnlyCallback
/// first blush, but it's the same principle. In general, as long as the user
/// doesn't access a Future or Promise object from more than one thread at a
/// time there won't be any problems.
-template<typename T>
+template <typename T>
class Core final {
static_assert(!std::is_void<T>::value,
"void futures are not supported. Use Unit instead.");
if (ready()) {
return *result_;
} else {
- throw FutureNotReady();
+ throwFutureNotReady();
}
}
case State::OnlyCallback:
case State::Armed:
case State::Done:
- throw std::logic_error("setCallback called twice");
+ std::__throw_logic_error("setCallback called twice");
FSM_END
// we could always call this, it is an optimization to only call it when
case State::OnlyResult:
case State::Armed:
case State::Done:
- throw std::logic_error("setResult called twice");
+ std::__throw_logic_error("setResult called twice");
FSM_END
if (transitionToArmed) {
// base case
}
-template <template <typename ...> class T, typename... Ts,
- typename THead, typename... TTail>
+template <
+ template <typename...> class T,
+ typename... Ts,
+ typename THead,
+ typename... TTail>
void collectVariadicHelper(const std::shared_ptr<T<Ts...>>& ctx,
THead&& head, TTail&&... tail) {
using ValueType = typename std::decay<THead>::type::value_type;
collectVariadicHelper(ctx, std::forward<TTail>(tail)...);
}
-}} // folly::detail
+} // namespace detail
+} // namespace futures
+} // namespace folly