From 90be8fafb39469bd2c318c033e63294ebaad2ca4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 30 Nov 2025 14:25:32 +0100 Subject: Core/Misc: Use std::scoped_lock instead of unique_lock where possible (and old lock_guard) --- src/common/Configuration/Config.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/common/Configuration/Config.cpp') diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp index 946ff676e6f..11f78f7c0af 100644 --- a/src/common/Configuration/Config.cpp +++ b/src/common/Configuration/Config.cpp @@ -137,7 +137,7 @@ namespace bool ConfigMgr::LoadInitial(std::string file, std::vector args, std::string& error) { - std::lock_guard lock(_configLock); + std::scoped_lock lock(_configLock); _filename = std::move(file); _args = std::move(args); @@ -158,7 +158,7 @@ bool ConfigMgr::LoadAdditionalFile(std::string file, bool keepOnReload, std::str if (!LoadFile(file, fullTree, error)) return false; - std::lock_guard lock(_configLock); + std::scoped_lock lock(_configLock); for (bpt::ptree::value_type const& child : fullTree.begin()->second) _config.put_child(bpt::ptree::path_type(child.first, '/'), child.second); @@ -197,7 +197,7 @@ bool ConfigMgr::LoadAdditionalDir(std::string const& dir, bool keepOnReload, std std::vector ConfigMgr::OverrideWithEnvVariablesIfAny() { - std::lock_guard lock(_configLock); + std::scoped_lock lock(_configLock); std::vector overriddenKeys; @@ -346,7 +346,7 @@ float ConfigMgr::GetFloatDefault(std::string_view name, float def, bool quiet) c std::string const& ConfigMgr::GetFilename() { - std::lock_guard lock(_configLock); + std::scoped_lock lock(_configLock); return _filename; } @@ -357,7 +357,7 @@ std::vector const& ConfigMgr::GetArguments() const std::vector ConfigMgr::GetKeysByString(std::string const& name) { - std::lock_guard lock(_configLock); + std::scoped_lock lock(_configLock); std::vector keys; -- cgit v1.2.3