diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index 81ea917b6..d4592b4ef 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -413,13 +413,7 @@ void ConfigObject::OnConfigLoaded() void ConfigObject::OnAllConfigLoaded() { - static ConfigType *ctype; - - if (!ctype) { - Type::Ptr type = Type::GetByName("Zone"); - ctype = dynamic_cast(type.get()); - } - + static ConfigType *ctype = dynamic_cast(Type::GetByName("Zone").get()); String zoneName = GetZoneName(); if (!zoneName.IsEmpty()) diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 8e6ab0e91..37c711d65 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -21,6 +21,7 @@ #include "base/function.hpp" #include "base/utility.hpp" #include +#include #include #include #include @@ -462,7 +463,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue if (unresolved_dep) continue; - int committed_items = 0; + std::atomic committed_items(0); upq.ParallelFor(items, [&type, &committed_items](const ItemPair& ip) { const ConfigItem::Ptr& item = ip.first; @@ -514,7 +515,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue if (unresolved_dep) continue; - int notified_items = 0; + std::atomic notified_items(0); upq.ParallelFor(items, [&type, ¬ified_items](const ItemPair& ip) { const ConfigItem::Ptr& item = ip.first;