From 1bc610c2c678569cee1339db20fa97fc35ad6f92 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Fri, 26 Aug 2016 10:51:13 -0700 Subject: [PATCH] Use intrusive base hook rather than a member hook Summary: Because MSVC is not happy about the member hook when used in complex inheritence scenarios. Reviewed By: yfeldblum Differential Revision: D3774513 fbshipit-source-id: 9e1ef8dd76d966de339f8486ff1a1d0ab1571849 --- folly/io/async/HHWheelTimer.cpp | 2 +- folly/io/async/HHWheelTimer.h | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/folly/io/async/HHWheelTimer.cpp b/folly/io/async/HHWheelTimer.cpp index 6433581e..ca372502 100644 --- a/folly/io/async/HHWheelTimer.cpp +++ b/folly/io/async/HHWheelTimer.cpp @@ -68,7 +68,7 @@ void HHWheelTimer::Callback::cancelTimeoutImpl() { assert(wheel_->count_ == 0); wheel_->AsyncTimeout::cancelTimeout(); } - hook_.unlink(); + unlink(); if ((-1 != bucket_) && (wheel_->buckets_[0][bucket_].empty())) { auto bi = makeBitIterator(wheel_->bitmap_.begin()); *(bi + bucket_) = false; diff --git a/folly/io/async/HHWheelTimer.h b/folly/io/async/HHWheelTimer.h index 33af9f34..4c33239d 100644 --- a/folly/io/async/HHWheelTimer.h +++ b/folly/io/async/HHWheelTimer.h @@ -66,7 +66,9 @@ class HHWheelTimer : private folly::AsyncTimeout, /** * A callback to be notified when a timeout has expired. */ - class Callback { + class Callback + : public boost::intrusive::list_base_hook< + boost::intrusive::link_mode> { public: Callback() : wheel_(nullptr) @@ -134,14 +136,8 @@ class HHWheelTimer : private folly::AsyncTimeout, std::chrono::milliseconds expiration_; int bucket_{-1}; - typedef boost::intrusive::list_member_hook< - boost::intrusive::link_mode > ListHook; - - ListHook hook_; - typedef boost::intrusive::list< Callback, - boost::intrusive::member_hook, boost::intrusive::constant_time_size > List; std::shared_ptr context_; -- 2.34.1