| 161 | } |
| 162 | |
| 163 | void ApplicationContext::ComponentHolder::create_singleton( |
| 164 | ApplicationContext& context) noexcept { |
| 165 | ::std::lock_guard<std::recursive_mutex> lock(*_mutex); |
| 166 | if (_singleton_state == ComponentHolder::SingletonState::INITIALIZING) { |
| 167 | BABYLON_LOG(WARNING) |
| 168 | << "initialize failed for recursive dependent component of type " |
| 169 | << _type_id->type_id; |
| 170 | return; |
| 171 | } |
| 172 | if (_singleton_state == ComponentHolder::SingletonState::UNINITIALIZED) { |
| 173 | _singleton_state = ComponentHolder::SingletonState::INITIALIZING; |
| 174 | _singleton = create(context); |
| 175 | _sequence = next_sequence(); |
| 176 | atomic_singleton_state().store(ComponentHolder::SingletonState::INITIALIZED, |
| 177 | ::std::memory_order_release); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | #pragma GCC diagnostic push |
| 182 | #pragma GCC diagnostic ignored "-Wpragmas" |
nothing calls this directly
no outgoing calls
no test coverage detected