mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Misc: Use std::scoped_lock instead of unique_lock where possible (and old lock_guard)
This commit is contained in:
@@ -93,7 +93,7 @@ void SecretMgr::Initialize(SecretOwner owner)
|
||||
{
|
||||
if (secret_info[i].flags() & SECRET_FLAG_DEFER_LOAD)
|
||||
continue;
|
||||
std::unique_lock<std::mutex> lock(_secrets[i].lock);
|
||||
std::scoped_lock lock(_secrets[i].lock);
|
||||
AttemptLoad(Secrets(i), LOG_LEVEL_FATAL, lock);
|
||||
if (!_secrets[i].IsAvailable())
|
||||
ABORT(); // load failed
|
||||
@@ -102,14 +102,14 @@ void SecretMgr::Initialize(SecretOwner owner)
|
||||
|
||||
SecretMgr::Secret const& SecretMgr::GetSecret(Secrets i)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(_secrets[i].lock);
|
||||
std::scoped_lock lock(_secrets[i].lock);
|
||||
|
||||
if (_secrets[i].state == Secret::NOT_LOADED_YET)
|
||||
AttemptLoad(i, LOG_LEVEL_ERROR, lock);
|
||||
return _secrets[i];
|
||||
}
|
||||
|
||||
void SecretMgr::AttemptLoad(Secrets i, LogLevel errorLevel, std::unique_lock<std::mutex> const&)
|
||||
void SecretMgr::AttemptLoad(Secrets i, LogLevel errorLevel, std::scoped_lock<std::mutex> const&)
|
||||
{
|
||||
auto const& info = secret_info[i];
|
||||
Optional<std::string> oldDigest;
|
||||
|
||||
Reference in New Issue
Block a user