Commit a88cfa0b authored by Luca Niccolini's avatar Luca Niccolini Committed by Facebook Github Bot

Revert D15177816: [folly] Fix de-ref of evb after evb deletion

Differential Revision:
D15177816

Original commit changeset: 7298fcdc3a73

fbshipit-source-id: fc62ec2ecf7fb06bc60cdd0c33b17b53fe35af19
parent 9616c483
...@@ -163,10 +163,6 @@ EventBase::~EventBase() { ...@@ -163,10 +163,6 @@ EventBase::~EventBase() {
virtualEventBaseDestroyFuture.get(); virtualEventBaseDestroyFuture.get();
} }
// Destruction of the wheel timer may trigger cancellation callbacks.
// Run those before destruction callbacks.
wheelTimer_.reset();
// Call all destruction callbacks, before we start cleaning up our state. // Call all destruction callbacks, before we start cleaning up our state.
while (!onDestructionCallbacks_.rlock()->empty()) { while (!onDestructionCallbacks_.rlock()->empty()) {
OnDestructionCallback::List callbacks; OnDestructionCallback::List callbacks;
......
...@@ -2129,28 +2129,3 @@ TEST(EventBaseTest, RunOnDestructionAddCallbackWithinCallback) { ...@@ -2129,28 +2129,3 @@ TEST(EventBaseTest, RunOnDestructionAddCallbackWithinCallback) {
} }
EXPECT_EQ(2, callbacksCalled); EXPECT_EQ(2, callbacksCalled);
} }
class TestWheelTimeout : public HHWheelTimer::Callback {
public:
~TestWheelTimeout() override = default;
void callbackCanceled() noexcept override {
// This is invoked when the EventBase is destroyed
canceled = true;
}
void timeoutExpired() noexcept override {}
bool canceled{false};
};
TEST(EventBaseTest, WheelTimerWhileDestroyingEvb) {
TestWheelTimeout timeout;
{
EventBase eb;
eb.runOnDestruction([&]() { EXPECT_TRUE(timeout.canceled); });
auto& timer = eb.timer();
timer.scheduleTimeout(&timeout, std::chrono::seconds(10));
}
}
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