/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
#include <folly/futures/Future.h>
-#include <folly/futures/detail/ThreadWheelTimekeeper.h>
+#include <folly/futures/ThreadWheelTimekeeper.h>
#include <folly/Likely.h>
namespace folly {
// Instantiate the most common Future types to save compile time
-template class Future<void>;
+template class Future<Unit>;
template class Future<bool>;
template class Future<int>;
template class Future<int64_t>;
namespace folly { namespace futures {
-Future<void> sleep(Duration dur, Timekeeper* tk) {
+Future<Unit> sleep(Duration dur, Timekeeper* tk) {
+ std::shared_ptr<Timekeeper> tks;
if (LIKELY(!tk)) {
- tk = detail::getTimekeeperSingleton();
+ tks = folly::detail::getTimekeeperSingleton();
+ tk = DCHECK_NOTNULL(tks.get());
}
return tk->after(dur);
}
}}
-
-namespace folly { namespace detail {
-
-template <>
-CollectContext<void>::~CollectContext() {
- if (!threw.exchange(true)) {
- p.setValue();
- }
-}
-
-template <>
-void CollectContext<void>::setPartialResult(size_t i, Try<void>& t) {
- // Nothing to do for void
-}
-
-}}