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

Function CompleteLazyInstance

src/butil/lazy_instance.cc:41–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41void CompleteLazyInstance(subtle::AtomicWord* state,
42 subtle::AtomicWord new_instance,
43 void* lazy_instance,
44 void (*dtor)(void*)) {
45 // See the comment to the corresponding HAPPENS_AFTER in Pointer().
46 ANNOTATE_HAPPENS_BEFORE(state);
47
48 // Instance is created, go from CREATING to CREATED.
49 // Releases visibility over private_buf_ to readers. Pairing Acquire_Load's
50 // are in NeedsInstance() and Pointer().
51 subtle::Release_Store(state, new_instance);
52
53 // Make sure that the lazily instantiated object will get destroyed at exit.
54 if (dtor)
55 AtExitManager::RegisterCallback(dtor, lazy_instance);
56}
57
58} // namespace internal
59} // namespace butil

Callers 1

PointerMethod · 0.85

Calls 1

Release_StoreFunction · 0.70

Tested by

no test coverage detected