Commit f5977149 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook Github Bot

Fix for the HHWheelTimer broken Windows build

Summary:
Fix for the HHWheelTimer broken Windows build

(Note: this ignores all push blocking failures!)

Reviewed By: yfeldblum

Differential Revision: D14642461

fbshipit-source-id: 07292429b1e27eafeb144ab529940aee86dcca6d
parent 047526d5
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
namespace folly { namespace folly {
/** /**
* We want to select the default interval carefully. * We want to select the default interval carefully.
* An interval of 10ms will give us 10ms * WHEEL_SIZE^WHEEL_BUCKETS * An interval of 10ms will give us 10ms * WHEEL_SIZE^WHEEL_BUCKETS
...@@ -40,8 +39,16 @@ namespace folly { ...@@ -40,8 +39,16 @@ namespace folly {
* start showing up in cpu perf. Also, it might not be possible to set * start showing up in cpu perf. Also, it might not be possible to set
* tick interval less than 10ms on older kernels. * tick interval less than 10ms on older kernels.
*/ */
/*
* For high res timers:
* An interval of 200usec will give us 200usec * WHEEL_SIZE^WHEEL_BUCKETS
* for the largest timeout possible, or about 9 days.
*/
template <class Duration> template <class Duration>
int HHWheelTimerBase<Duration>::DEFAULT_TICK_INTERVAL = 10; int HHWheelTimerBase<Duration>::DEFAULT_TICK_INTERVAL =
detail::HHWheelTimerDurationConst<Duration>::DEFAULT_TICK_INTERVAL;
template <class Duration> template <class Duration>
HHWheelTimerBase<Duration>::Callback::Callback() {} HHWheelTimerBase<Duration>::Callback::Callback() {}
......
...@@ -31,6 +31,21 @@ ...@@ -31,6 +31,21 @@
namespace folly { namespace folly {
namespace detail {
template <class Duration>
struct HHWheelTimerDurationConst;
template <>
struct HHWheelTimerDurationConst<std::chrono::milliseconds> {
static constexpr int DEFAULT_TICK_INTERVAL = 10;
};
template <>
struct HHWheelTimerDurationConst<std::chrono::microseconds> {
static constexpr int DEFAULT_TICK_INTERVAL = 200;
};
} // namespace detail
/** /**
* Hashed Hierarchical Wheel Timer * Hashed Hierarchical Wheel Timer
* *
...@@ -343,6 +358,7 @@ class HHWheelTimerBase : private folly::AsyncTimeout, ...@@ -343,6 +358,7 @@ class HHWheelTimerBase : private folly::AsyncTimeout,
} }
}; };
// std::chrono::milliseconds
using HHWheelTimer = HHWheelTimerBase<std::chrono::milliseconds>; using HHWheelTimer = HHWheelTimerBase<std::chrono::milliseconds>;
extern template class HHWheelTimerBase<std::chrono::milliseconds>; extern template class HHWheelTimerBase<std::chrono::milliseconds>;
......
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