Commit a93b1f39 authored by Chad Parry's avatar Chad Parry Committed by facebook-github-bot-9

Make sure there are no outstanding timers in the destructor

Summary: This is the solution for our `HHWheelTimer` crashes, as suggested in D2617966#25.

djwatson also mentioned that maybe there should be some logging in the destructor if there are outstanding callbacks. I couldn't think of anything that would add to the `assert` that already exists in `destroy`. I'm open to suggestions though.

Reviewed By: djwatson

Differential Revision: D2628154

fb-gh-sync-id: f3db6e9384517c9bf3cbb60af8c1e711703a07fa
parent 408597e5
...@@ -94,10 +94,12 @@ HHWheelTimer::HHWheelTimer(folly::EventBase* eventBase, ...@@ -94,10 +94,12 @@ HHWheelTimer::HHWheelTimer(folly::EventBase* eventBase,
} }
HHWheelTimer::~HHWheelTimer() { HHWheelTimer::~HHWheelTimer() {
CHECK(count_ == 0);
} }
void HHWheelTimer::destroy() { void HHWheelTimer::destroy() {
assert(count_ == 0); assert(count_ == 0);
cancelAll();
DelayedDestruction::destroy(); DelayedDestruction::destroy();
} }
......
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