Commit 64699b9b authored by Alan Frindell's avatar Alan Frindell Committed by Sara Golemon

Add internal mode for HHWheelTimer

Summary:
This allows an EventBase to exit loop() even if there are pending timeouts in the timer (make sure to cancelAll before deleting!)

Test Plan: Unit tests

Reviewed By: davejwatson@fb.com

Subscribers: doug, folly-diffs@, yfeldblum, chalfant

FB internal diff: D2111942

Signature: t1:2111942:1432934212:7ac1973bdbbfdbda714699ab373618399f29ef76
parent c768c3f4
...@@ -76,8 +76,9 @@ void HHWheelTimer::Callback::cancelTimeoutImpl() { ...@@ -76,8 +76,9 @@ void HHWheelTimer::Callback::cancelTimeoutImpl() {
} }
HHWheelTimer::HHWheelTimer(folly::EventBase* eventBase, HHWheelTimer::HHWheelTimer(folly::EventBase* eventBase,
std::chrono::milliseconds intervalMS) std::chrono::milliseconds intervalMS,
: AsyncTimeout(eventBase) AsyncTimeout::InternalEnum internal)
: AsyncTimeout(eventBase, internal)
, interval_(intervalMS) , interval_(intervalMS)
, nextTick_(1) , nextTick_(1)
, count_(0) , count_(0)
......
...@@ -153,7 +153,9 @@ class HHWheelTimer : private folly::AsyncTimeout, ...@@ -153,7 +153,9 @@ class HHWheelTimer : private folly::AsyncTimeout,
static int DEFAULT_TICK_INTERVAL; static int DEFAULT_TICK_INTERVAL;
explicit HHWheelTimer(folly::EventBase* eventBase, explicit HHWheelTimer(folly::EventBase* eventBase,
std::chrono::milliseconds intervalMS = std::chrono::milliseconds intervalMS =
std::chrono::milliseconds(DEFAULT_TICK_INTERVAL)); std::chrono::milliseconds(DEFAULT_TICK_INTERVAL),
AsyncTimeout::InternalEnum internal =
AsyncTimeout::InternalEnum::NORMAL);
/** /**
* Destroy the HHWheelTimer. * Destroy the HHWheelTimer.
......
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