proxygen
|
#include <UndelayedDestruction.h>
Public Member Functions | |
template<typename... Args> | |
UndelayedDestruction (Args &&...args) | |
~UndelayedDestruction () override | |
void | onDelayedDestroy (bool delayed) override |
Protected Member Functions | |
void | destroy () override |
Private Member Functions | |
UndelayedDestruction (UndelayedDestruction const &)=delete | |
UndelayedDestruction & | operator= (UndelayedDestruction const &)=delete |
A helper class to allow a DelayedDestruction object to be instantiated on the stack.
This class derives from an existing DelayedDestruction type and makes the destructor public again. This allows objects of this type to be declared on the stack or directly inside another class. Normally DelayedDestruction objects must be dynamically allocated on the heap.
However, the trade-off is that you lose some of the protections provided by DelayedDestruction::destroy(). DelayedDestruction::destroy() will automatically delay destruction of the object until it is safe to do so. If you use UndelayedDestruction, you become responsible for ensuring that you only destroy the object where it is safe to do so. Attempting to destroy a UndelayedDestruction object while it has a non-zero destructor guard count will abort the program.
Definition at line 44 of file UndelayedDestruction.h.
|
inlineexplicit |
Definition at line 57 of file UndelayedDestruction.h.
Referenced by folly::UndelayedDestruction< HHWheelTimer >::destroy().
|
inlineoverride |
Public destructor.
The caller is responsible for ensuring that the object is only destroyed where it is safe to do so. (i.e., when the destructor guard count is 0).
The exact conditions for meeting this may be dependent upon your class semantics. Typically you are only guaranteed that it is safe to destroy the object directly from the event loop (e.g., directly from a EventBase::LoopCallback), or when the event loop is stopped.
Definition at line 71 of file UndelayedDestruction.h.
|
privatedelete |
|
inlineoverrideprotected |
Override our parent's destroy() method to make it protected. Callers should use the normal destructor instead of destroy
Definition at line 97 of file UndelayedDestruction.h.
Referenced by folly::UndelayedDestruction< HHWheelTimer >::~UndelayedDestruction().
|
inlineoverride |
Definition at line 81 of file UndelayedDestruction.h.
|
privatedelete |
Referenced by folly::UndelayedDestruction< HHWheelTimer >::destroy().