From 7da6dd4d516a27cf6581c3378d302b21ed6fb784 Mon Sep 17 00:00:00 2001 From: Osyotr Date: Wed, 3 Jan 2024 23:05:45 +0300 Subject: [PATCH] Fix syncronization in TrafficCache warning C4930: 'std::lock_guard guard(std::mutex)': prototyped function not called (was a variable definition intended?) Signed-off-by: Osyotr --- traffic/traffic_cache.cpp | 13 ++++++------- traffic/traffic_cache.hpp | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/traffic/traffic_cache.cpp b/traffic/traffic_cache.cpp index 604aeee80f..23037a2cd2 100644 --- a/traffic/traffic_cache.cpp +++ b/traffic/traffic_cache.cpp @@ -2,29 +2,28 @@ namespace traffic { -using namespace std; -void TrafficCache::Set(MwmSet::MwmId const & mwmId, shared_ptr coloring) +void TrafficCache::Set(MwmSet::MwmId const & mwmId, std::shared_ptr coloring) { - lock_guard guard(mutex); - m_trafficColoring[mwmId] = coloring; + auto guard = std::lock_guard(m_mutex); + m_trafficColoring[mwmId] = std::move(coloring); } void TrafficCache::Remove(MwmSet::MwmId const & mwmId) { - lock_guard guard(mutex); + auto guard = std::lock_guard(m_mutex); m_trafficColoring.erase(mwmId); } void TrafficCache::CopyTraffic(AllMwmTrafficInfo & trafficColoring) const { - lock_guard guard(mutex); + auto guard = std::lock_guard(m_mutex); trafficColoring = m_trafficColoring; } void TrafficCache::Clear() { - lock_guard guard(mutex); + auto guard = std::lock_guard(m_mutex); m_trafficColoring.clear(); } } // namespace traffic diff --git a/traffic/traffic_cache.hpp b/traffic/traffic_cache.hpp index 2e960e7700..d80a5f3536 100644 --- a/traffic/traffic_cache.hpp +++ b/traffic/traffic_cache.hpp @@ -15,7 +15,7 @@ using AllMwmTrafficInfo = std::map