MCPcopy Create free account
hub / github.com/apache/brpc / RemoveRefManually

Method RemoveRefManually

src/butil/shared_object.h:49–54  ·  view source on GitHub ↗

Remove one ref, if the ref_count hit zero, delete this object. Same as butil::intrusive_ptr (obj, false).reset(NULL)

Source from the content-addressed store, hash-verified

47 // Remove one ref, if the ref_count hit zero, delete this object.
48 // Same as butil::intrusive_ptr<T>(obj, false).reset(NULL)
49 void RemoveRefManually() {
50 if (_nref.fetch_sub(1, butil::memory_order_release) == 1) {
51 butil::atomic_thread_fence(butil::memory_order_acquire);
52 delete this;
53 }
54 }
55
56protected:
57 virtual ~SharedObject() { }

Callers 2

SignalTraceMethod · 0.45
intrusive_ptr_releaseFunction · 0.45

Calls 2

atomic_thread_fenceFunction · 0.85
fetch_subMethod · 0.80

Tested by

no test coverage detected