/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (getDestructorGuardCount() != 0) {
destroyPending_ = true;
} else {
- onDestroy_(false);
+ onDelayedDestroy(false);
}
}
* shared_ptr using a DelayedDestruction::Destructor as the second argument
* to the shared_ptr constructor.
*/
- virtual ~DelayedDestruction() = default;
+ ~DelayedDestruction() override = default;
DelayedDestruction()
: destroyPending_(false) {
-
- onDestroy_ = [this] (bool delayed) {
- // check if it is ok to destroy now
- if (delayed && !destroyPending_) {
- return;
- }
- destroyPending_ = false;
- delete this;
- };
}
private:
* guardCount_ drops to 0.
*/
bool destroyPending_;
+
+ void onDelayedDestroy(bool delayed) override {
+ // check if it is ok to destroy now
+ if (delayed && !destroyPending_) {
+ return;
+ }
+ destroyPending_ = false;
+ delete this;
+ }
};
-} // folly
+} // namespace folly