class HHWheelTimer : private folly::AsyncTimeout,
public folly::DelayedDestruction {
public:
- // This type has always been a misnomer, because it is not a unique pointer.
using UniquePtr = std::unique_ptr<HHWheelTimer, Destructor>;
using SharedPtr = std::shared_ptr<HHWheelTimer>;
return wheel_ != nullptr;
}
+ /**
+ * Get the time remaining until this timeout expires. Return 0 if this
+ * timeout is not scheduled or expired. Otherwise, return expiration time
+ * minus getCurTime().
+ */
+ std::chrono::milliseconds getTimeRemaining() {
+ return getTimeRemaining(getCurTime());
+ }
+
protected:
/**
* Don't override this unless you're doing a test. This is mainly here so
* Use destroy() instead. See the comments in DelayedDestruction for more
* details.
*/
- virtual ~HHWheelTimer();
+ ~HHWheelTimer() override;
private:
// Forbidden copy constructor and assignment operator
HHWheelTimer& operator=(HHWheelTimer const &) = delete;
// Methods inherited from AsyncTimeout
- virtual void timeoutExpired() noexcept;
+ void timeoutExpired() noexcept override;
std::chrono::milliseconds interval_;
std::chrono::milliseconds defaultTimeout_;
}
};
-} // folly
+} // namespace folly