MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Unref

Method Unref

tensorflow/core/lib/core/refcount.h:101–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101inline bool RefCounted::Unref() const {
102 DCHECK_GT(ref_.load(), 0);
103 // If ref_==1, this object is owned only by the caller. Bypass a locked op
104 // in that case.
105 if (RefCountIsOne() || ref_.fetch_sub(1) == 1) {
106 // Make DCHECK in ~RefCounted happy
107 DCHECK((ref_.store(0), true));
108 delete this;
109 return true;
110 } else {
111 return false;
112 }
113}
114
115inline bool RefCounted::RefCountIsOne() const {
116 return (ref_.load(std::memory_order_acquire) == 1);

Callers 15

ComputeMethod · 0.45
ComputeMethod · 0.45
ComputeMethod · 0.45
~DatasetMethod · 0.45
~DatasetMethod · 0.45
~DatasetMethod · 0.45
~DatasetMethod · 0.45
~DatasetMethod · 0.45
~DatasetMethod · 0.45
RunMethod · 0.45
DestroyMethod · 0.45

Calls 1

loadMethod · 0.45

Tested by 15

CompileMethod · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
~RingGathererTestMethod · 0.36
DoGatherMethod · 0.36
TESTFunction · 0.36
~RendezvousUtilTestMethod · 0.36
TEST_FFunction · 0.36
~RingReducerTestMethod · 0.36
DoReduceMethod · 0.36
CleanupMethod · 0.36