]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2311] fix warning regarding capture of ‘this’
authorAndrei Pavel <andrei@isc.org>
Mon, 24 Oct 2022 16:46:26 +0000 (19:46 +0300)
committerAndrei Pavel <andrei@isc.org>
Mon, 24 Oct 2022 18:05:35 +0000 (21:05 +0300)
Warning happens when NETCONF is disabled on some compilers.

warning: explicit by-copy capture of ‘this’ redundant with by-copy capture default [enabled by default]

OR

warning: explicit capture of 'this' with a capture default of '=' is a C++20 extension

src/lib/util/readwrite_mutex.h

index 4a6ecfe3fa906546954e7346316a914ad31f8fab..4dd7a5e1092a77663e43549519e25d64650e8b1e 100644 (file)
@@ -54,10 +54,10 @@ public:
     void writeLock() {
         std::unique_lock<std::mutex> lk(mutex_);
         // Wait until the write entered flag can be set.
-        gate1_.wait(lk, [=, this]() { return (!writeEntered()); });
+        gate1_.wait(lk, [&]() { return (!writeEntered()); });
         state_ |= WRITE_ENTERED;
         // Wait until there are no more readers.
-        gate2_.wait(lk, [=, this]() { return (readers() == 0); });
+        gate2_.wait(lk, [&]() { return (readers() == 0); });
     }
 
     /// @brief Unlock write.
@@ -74,7 +74,7 @@ public:
     void readLock() {
         std::unique_lock<std::mutex> lk(mutex_);
         // Wait if there is a writer or if readers overflow.
-        gate1_.wait(lk, [=, this]() { return (state_ < MAX_READERS); });
+        gate1_.wait(lk, [&]() { return (state_ < MAX_READERS); });
         ++state_;
     }