From 6e461de50e73c0c957af73e5ee7a25f4d0293490 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 26 Mar 2024 12:23:51 +0100 Subject: Make all mutex locks const, as per linter warning --- src/syncedsettings.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/syncedsettings.h') diff --git a/src/syncedsettings.h b/src/syncedsettings.h index 0fe5efd..d12277a 100644 --- a/src/syncedsettings.h +++ b/src/syncedsettings.h @@ -64,7 +64,7 @@ public: : mutex{} , data{} { - std::lock_guard lock{other.mutex}; + const std::lock_guard lock{other.mutex}; data = other.data; } @@ -72,7 +72,7 @@ public: : mutex{} , data{} { - std::lock_guard lock{other.mutex}; + const std::lock_guard lock{other.mutex}; std::swap(data, other.data); } @@ -80,19 +80,19 @@ public: { if (*this != &other) { - std::lock_guard lock{mutex}; - std::lock_guard lock2{other.mutex}; + const std::lock_guard lock{mutex}; + const std::lock_guard lock2{other.mutex}; data = other.data; } return *this; } - + Group& operator=(Group&& other) { if (*this != &other) { - std::lock_guard lock{mutex}; - std::lock_guard lock2{other.mutex}; + const std::lock_guard lock{mutex}; + const std::lock_guard lock2{other.mutex}; std::swap(data, other.data); } return *this; @@ -100,7 +100,7 @@ public: operator T() const { - std::lock_guard lock{mutex}; + const std::lock_guard lock{mutex}; return data; } }; -- cgit v1.2.3