From 64699b9b34fb36d895bc2fac6effbd362976f402 Mon Sep 17 00:00:00 2001 From: Alan Frindell Date: Mon, 8 Jun 2015 09:37:42 -0700 Subject: [PATCH] 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 --- folly/io/async/HHWheelTimer.cpp | 5 +++-- folly/io/async/HHWheelTimer.h | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/folly/io/async/HHWheelTimer.cpp b/folly/io/async/HHWheelTimer.cpp index a75dc734..2bc9eae7 100644 --- a/folly/io/async/HHWheelTimer.cpp +++ b/folly/io/async/HHWheelTimer.cpp @@ -76,8 +76,9 @@ void HHWheelTimer::Callback::cancelTimeoutImpl() { } HHWheelTimer::HHWheelTimer(folly::EventBase* eventBase, - std::chrono::milliseconds intervalMS) - : AsyncTimeout(eventBase) + std::chrono::milliseconds intervalMS, + AsyncTimeout::InternalEnum internal) + : AsyncTimeout(eventBase, internal) , interval_(intervalMS) , nextTick_(1) , count_(0) diff --git a/folly/io/async/HHWheelTimer.h b/folly/io/async/HHWheelTimer.h index 86e67063..56ded208 100644 --- a/folly/io/async/HHWheelTimer.h +++ b/folly/io/async/HHWheelTimer.h @@ -153,7 +153,9 @@ class HHWheelTimer : private folly::AsyncTimeout, static int DEFAULT_TICK_INTERVAL; explicit HHWheelTimer(folly::EventBase* eventBase, 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. -- 2.34.1