From: Andrei Pavel Date: Mon, 24 Oct 2022 16:46:26 +0000 (+0300) Subject: [#2311] fix warning regarding capture of ‘this’ X-Git-Tag: Kea-2.3.2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa14bef3ce91e13304ecbab5e10008e145ce6e02;p=thirdparty%2Fkea.git [#2311] fix warning regarding capture of ‘this’ 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 --- diff --git a/src/lib/util/readwrite_mutex.h b/src/lib/util/readwrite_mutex.h index 4a6ecfe3fa..4dd7a5e109 100644 --- a/src/lib/util/readwrite_mutex.h +++ b/src/lib/util/readwrite_mutex.h @@ -54,10 +54,10 @@ public: void writeLock() { std::unique_lock 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 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_; }