Commit 1bc610c2 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

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
parent 243fbe8d
...@@ -68,7 +68,7 @@ void HHWheelTimer::Callback::cancelTimeoutImpl() { ...@@ -68,7 +68,7 @@ void HHWheelTimer::Callback::cancelTimeoutImpl() {
assert(wheel_->count_ == 0); assert(wheel_->count_ == 0);
wheel_->AsyncTimeout::cancelTimeout(); wheel_->AsyncTimeout::cancelTimeout();
} }
hook_.unlink(); unlink();
if ((-1 != bucket_) && (wheel_->buckets_[0][bucket_].empty())) { if ((-1 != bucket_) && (wheel_->buckets_[0][bucket_].empty())) {
auto bi = makeBitIterator(wheel_->bitmap_.begin()); auto bi = makeBitIterator(wheel_->bitmap_.begin());
*(bi + bucket_) = false; *(bi + bucket_) = false;
......
...@@ -66,7 +66,9 @@ class HHWheelTimer : private folly::AsyncTimeout, ...@@ -66,7 +66,9 @@ class HHWheelTimer : private folly::AsyncTimeout,
/** /**
* A callback to be notified when a timeout has expired. * A callback to be notified when a timeout has expired.
*/ */
class Callback { class Callback
: public boost::intrusive::list_base_hook<
boost::intrusive::link_mode<boost::intrusive::auto_unlink>> {
public: public:
Callback() Callback()
: wheel_(nullptr) : wheel_(nullptr)
...@@ -134,14 +136,8 @@ class HHWheelTimer : private folly::AsyncTimeout, ...@@ -134,14 +136,8 @@ class HHWheelTimer : private folly::AsyncTimeout,
std::chrono::milliseconds expiration_; std::chrono::milliseconds expiration_;
int bucket_{-1}; int bucket_{-1};
typedef boost::intrusive::list_member_hook<
boost::intrusive::link_mode<boost::intrusive::auto_unlink> > ListHook;
ListHook hook_;
typedef boost::intrusive::list< typedef boost::intrusive::list<
Callback, Callback,
boost::intrusive::member_hook<Callback, ListHook, &Callback::hook_>,
boost::intrusive::constant_time_size<false> > List; boost::intrusive::constant_time_size<false> > List;
std::shared_ptr<RequestContext> context_; std::shared_ptr<RequestContext> context_;
......
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