projects
/
folly.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
In SemiFuture members, fix DCHECK of pointer types
[folly.git]
/
folly
/
futures
/
Future.cpp
diff --git
a/folly/futures/Future.cpp
b/folly/futures/Future.cpp
index e4265ebc55016f46b52c6c8cfe48d004c3709f4e..49e4c02c3ad358f04e6d10cbc320a66fca4c68cd 100644
(file)
--- a/
folly/futures/Future.cpp
+++ b/
folly/futures/Future.cpp
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 201
5
Facebook, Inc.
+ * Copyright 201
7
Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-13,29
+13,44
@@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include <folly/futures/Future.h>
#include <folly/futures/Future.h>
-#include <folly/futures/detail/ThreadWheelTimekeeper.h>
#include <folly/Likely.h>
#include <folly/Likely.h>
+#include <folly/futures/ThreadWheelTimekeeper.h>
namespace folly {
// Instantiate the most common Future types to save compile time
namespace folly {
// Instantiate the most common Future types to save compile time
+template class SemiFuture<Unit>;
+template class SemiFuture<bool>;
+template class SemiFuture<int>;
+template class SemiFuture<int64_t>;
+template class SemiFuture<std::string>;
+template class SemiFuture<double>;
template class Future<Unit>;
template class Future<bool>;
template class Future<int>;
template class Future<int64_t>;
template class Future<std::string>;
template class Future<double>;
template class Future<Unit>;
template class Future<bool>;
template class Future<int>;
template class Future<int64_t>;
template class Future<std::string>;
template class Future<double>;
+} // namespace folly
-}
-
-namespace folly { namespace futures {
+namespace folly {
+namespace futures {
Future<Unit> sleep(Duration dur, Timekeeper* tk) {
Future<Unit> sleep(Duration dur, Timekeeper* tk) {
+ std::shared_ptr<Timekeeper> tks;
if (LIKELY(!tk)) {
if (LIKELY(!tk)) {
- tk = detail::getTimekeeperSingleton();
+ tks = folly::detail::getTimekeeperSingleton();
+ tk = tks.get();
}
}
+
+ if (UNLIKELY(!tk)) {
+ return makeFuture<Unit>(NoTimekeeper());
+ }
+
return tk->after(dur);
}
return tk->after(dur);
}
-}}
+} // namespace futures
+} // namespace folly