From fb21345bfd0d5e7a2481a79c242881010743a1da Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Fri, 25 Feb 2022 15:17:33 +0100 Subject: [PATCH] ConfigItem: Use atomic variables for notified and commited items count --- lib/config/configitem.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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;