| 39 | } |
| 40 | |
| 41 | void 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 |
no test coverage detected