diff options
| author | Shauren <shauren.trinity@gmail.com> | 2025-11-30 14:25:32 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2025-11-30 14:25:32 +0100 |
| commit | 90be8fafb39469bd2c318c033e63294ebaad2ca4 (patch) | |
| tree | 2d2d5424e54339b7581f9e224e909d6f08003136 /src/common/Configuration/Config.cpp | |
| parent | d3f2aee245d62c70c940831531b17da821053f91 (diff) | |
Core/Misc: Use std::scoped_lock instead of unique_lock where possible (and old lock_guard)
Diffstat (limited to 'src/common/Configuration/Config.cpp')
| -rw-r--r-- | src/common/Configuration/Config.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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<std::string> args, std::string& error) { - std::lock_guard<std::mutex> 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<std::mutex> 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<std::string> ConfigMgr::OverrideWithEnvVariablesIfAny() { - std::lock_guard<std::mutex> lock(_configLock); + std::scoped_lock lock(_configLock); std::vector<std::string> 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<std::mutex> lock(_configLock); + std::scoped_lock lock(_configLock); return _filename; } @@ -357,7 +357,7 @@ std::vector<std::string> const& ConfigMgr::GetArguments() const std::vector<std::string> ConfigMgr::GetKeysByString(std::string const& name) { - std::lock_guard<std::mutex> lock(_configLock); + std::scoped_lock lock(_configLock); std::vector<std::string> keys; |
