class CordzHandle
Defined at line 35 of file ../../third_party/abseil-cpp/absl/strings/internal/cordz_handle.h
This base class allows multiple types of object (CordzInfo and
CordzSampleToken) to exist simultaneously on the delete queue (pointed to by
global_dq_tail and traversed using dq_prev_ and dq_next_). The
delete queue guarantees that once a profiler creates a CordzSampleToken and
has gained visibility into a CordzInfo object, that CordzInfo object will not
be deleted prematurely. This allows the profiler to inspect all CordzInfo
objects that are alive without needing to hold a global lock.
Public Methods
void CordzHandle ()
Defined at line 37 of file ../../third_party/abseil-cpp/absl/strings/internal/cordz_handle.h
bool SafeToDelete ()
Returns true if this instance is safe to be deleted because it is either a
snapshot, which is always safe to delete, or not included in the global
delete queue and thus not included in any snapshot.
Callers are responsible for making sure this instance can not be newly
discovered by other threads. For example, CordzInfo instances first de-list
themselves from the global CordzInfo list before determining if they are
safe to be deleted directly.
If SafeToDelete returns false, callers MUST use the Delete() method to
safely queue CordzHandle instances for deletion.
void Delete (CordzHandle * handle)
Deletes the provided instance, or puts it on the delete queue to be deleted
once there are no more sample tokens (snapshot) instances potentially
referencing the instance. `handle` should not be null.
std::vector<const CordzHandle *> DiagnosticsGetDeleteQueue ()
Returns the current entries in the delete queue in LIFO order.
bool DiagnosticsHandleIsSafeToInspect (const CordzHandle * handle)
Returns true if the provided handle is nullptr or guarded by this handle.
Since the CordzSnapshot token is itself a CordzHandle, this method will
allow tests to check if that token is keeping an arbitrary CordzHandle
alive.
std::vector<const CordzHandle *> DiagnosticsGetSafeToInspectDeletedHandles ()
Returns the current entries in the delete queue, in LIFO order, that are
protected by this. CordzHandle objects are only placed on the delete queue
after CordzHandle::Delete is called with them as an argument. Only
CordzHandle objects that are not also CordzSnapshot objects will be
included in the return vector. For each of the handles in the return
vector, the earliest that their memory can be freed is when this
CordzSnapshot object is deleted.
bool is_snapshot ()
Defined at line 39 of file ../../third_party/abseil-cpp/absl/strings/internal/cordz_handle.h
Protected Methods
void CordzHandle (bool is_snapshot)
void ~CordzHandle ()