diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2024-03-26 12:23:51 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2024-03-26 12:23:51 +0100 |
commit | 6e461de50e73c0c957af73e5ee7a25f4d0293490 (patch) | |
tree | 03916b36c1cf0e25239b8d6cc0cf013b0fcb3697 /src/syncedsettings.h | |
parent | 702e6907265035af031004f21ce09e3f62037fb4 (diff) |
Make all mutex locks const, as per linter warning
Diffstat (limited to 'src/syncedsettings.h')
-rw-r--r-- | src/syncedsettings.h | 16 |
1 files changed, 8 insertions, 8 deletions
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<std::mutex> lock{other.mutex}; + const std::lock_guard<std::mutex> lock{other.mutex}; data = other.data; } @@ -72,7 +72,7 @@ public: : mutex{} , data{} { - std::lock_guard<std::mutex> lock{other.mutex}; + const std::lock_guard<std::mutex> lock{other.mutex}; std::swap(data, other.data); } @@ -80,19 +80,19 @@ public: { if (*this != &other) { - std::lock_guard<std::mutex> lock{mutex}; - std::lock_guard<std::mutex> lock2{other.mutex}; + const std::lock_guard<std::mutex> lock{mutex}; + const std::lock_guard<std::mutex> lock2{other.mutex}; data = other.data; } return *this; } - + Group<T>& operator=(Group<T>&& other) { if (*this != &other) { - std::lock_guard<std::mutex> lock{mutex}; - std::lock_guard<std::mutex> lock2{other.mutex}; + const std::lock_guard<std::mutex> lock{mutex}; + const std::lock_guard<std::mutex> lock2{other.mutex}; std::swap(data, other.data); } return *this; @@ -100,7 +100,7 @@ public: operator T() const { - std::lock_guard<std::mutex> lock{mutex}; + const std::lock_guard<std::mutex> lock{mutex}; return data; } }; |