-SingletonHolder<T>::SingletonHolder(TypeDescriptor type__,
- SingletonVault& vault) :
- type_(type__), vault_(vault) {
+SingletonHolder<T>::SingletonHolder(
+ TypeDescriptor typeDesc,
+ SingletonVault& vault)
+ : SingletonHolderBase(typeDesc), vault_(vault) {}
+
+template <typename T>
+bool SingletonHolder<T>::creationStarted() {
+ // If alive, then creation was of course started.
+ // This is flipped after creating_thread_ was set, and before it was reset.
+ if (state_.load(std::memory_order_acquire) == SingletonHolderState::Living) {
+ return true;
+ }
+
+ // Not yet built. Is it currently in progress?
+ if (creating_thread_.load(std::memory_order_acquire) != std::thread::id()) {
+ return true;
+ }
+
+ return false;