Go to the documentation of this file.
19 #ifndef GRPC_CORE_LIB_GPRPP_REF_COUNTED_H
20 #define GRPC_CORE_LIB_GPRPP_REF_COUNTED_H
70 const Value prior =
value_.fetch_add(
n, std::memory_order_relaxed);
76 value_.fetch_add(
n, std::memory_order_relaxed);
81 const Value prior =
value_.fetch_add(
n, std::memory_order_relaxed);
91 value_.fetch_add(
n, std::memory_order_relaxed);
98 const Value prior =
value_.fetch_add(1, std::memory_order_relaxed);
105 value_.fetch_add(1, std::memory_order_relaxed);
110 const Value prior =
value_.fetch_add(1, std::memory_order_relaxed);
130 trace_,
this, prior, prior + 1);
140 "%s:%p %s:%d ref_if_non_zero %" PRIdPTR
" -> %" PRIdPTR
" %s",
159 const Value prior =
value_.fetch_sub(1, std::memory_order_acq_rel);
161 if (trace !=
nullptr) {
162 gpr_log(
GPR_INFO,
"%s:%p unref %" PRIdPTR
" -> %" PRIdPTR, trace,
this,
176 const Value prior =
value_.fetch_sub(1, std::memory_order_acq_rel);
178 if (trace !=
nullptr) {
180 trace,
this, location.
file(), location.
line(), prior, prior - 1,
232 template <
typename T, UnrefBehavior UnrefBehaviorArg>
235 template <
typename T>
240 template <
typename T>
245 template <
typename T>
278 template <
typename Child,
typename Impl = PolymorphicRefCount,
320 ?
static_cast<Child*
>(
this)
332 :
refs_(initial_refcount, trace) {}
336 template <
typename T>
void RefNonZero(const DebugLocation &location, const char *reason)
std::atomic< Value > value_
#define GPR_DEBUG_ASSERT(x)
RefCountedPtr< Child > RefIfNonZero() GRPC_MUST_USE_RESULT
void Unref(const DebugLocation &location, const char *reason)
RefCounted(const char *trace=nullptr, intptr_t initial_refcount=1)
const char * file() const
void IncrementRefCount(const DebugLocation &location, const char *reason)
#define T(upbtypeconst, upbtype, ctype, default_value)
RefCountedPtr< Child > Ref(const DebugLocation &location, const char *reason) GRPC_MUST_USE_RESULT
RefCountedPtr< Child > RefIfNonZero(const DebugLocation &location, const char *reason) GRPC_MUST_USE_RESULT
RefCounted & operator=(const RefCounted &)=delete
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
~NonPolymorphicRefCount()=default
void Ref(const DebugLocation &location, const char *reason, Value n=1)
Security RefCountedChildType
bool Unref(const DebugLocation &location, const char *reason)
bool IncrementIfNonzero(std::atomic< T > *p)
bool RefIfNonZero(const DebugLocation &location, const char *reason)
virtual ~PolymorphicRefCount()=default
RefCounted(const RefCounted &)=delete
RefCountedPtr< Child > Ref() GRPC_MUST_USE_RESULT
RefCount(Value init=1, const char *trace=nullptr)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:07