void CoreContext::AddBolt(const std::shared_ptr<BoltBase>& pBase) { // Register all listeners as needed under lock { std::lock_guard<std::mutex> lk{ m_stateBlock->m_lock }; for (auto cur = pBase->GetContextSigils(); *cur; cur++) m_nameListeners[*cur].push_back(pBase.get()); if(!*pBase->GetContextSigils()) m_nameListeners[{}].push_back(pBase.get()); } // We intend to reset the context just once, when the function is done CurrentContextPusher pshr; // Post-hoc invocation of all already-created contexts: ContextEnumerator e{ shared_from_this() }; for (auto q = e.begin(); ++q != e.end(); ) { if (!pBase->Matches(q->GetSigilType())) break; q->SetCurrent(); pBase->ContextCreated(); } }