Tested x86_64-linux (and tested the affected code by manually bodging
the _GLIBCXX_USE_PTHREAD_RWLOCK_T macro).
Pushed to trunk.
-- >8 --
C++20 deprecates implicit capture of 'this', so change [=] to [this] for
all lambda expressions in <shared_mutex>. This only shows up on targets
where _GLIBCXX_USE_PTHREAD_RWLOCK_T is not defined, as we have an
alternative implementation of shared mutexes in that case.
libstdc++-v3/ChangeLog:
PR libstdc++/116964
* include/std/shared_mutex (__shared_mutex_cv): Use [this] for
lambda captures.
(shared_timed_mutex) [!_GLIBCXX_USE_PTHREAD_RWLOCK_T]: Likewise.
---
libstdc++-v3/include/std/shared_mutex | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libstdc++-v3/include/std/shared_mutex
b/libstdc++-v3/include/std/shared_mutex
index 9bf98c0b040..b369a15cc60 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -332,10 +332,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
unique_lock<mutex> __lk(_M_mut);
// Wait until we can set the write-entered flag.
- _M_gate1.wait(__lk, [=]{ return !_M_write_entered(); });
+ _M_gate1.wait(__lk, [this]{ return !_M_write_entered(); });
_M_state |= _S_write_entered;
// Then wait until there are no more readers.
- _M_gate2.wait(__lk, [=]{ return _M_readers() == 0; });
+ _M_gate2.wait(__lk, [this]{ return _M_readers() == 0; });
}
bool
@@ -367,7 +367,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
lock_shared()
{
unique_lock<mutex> __lk(_M_mut);
- _M_gate1.wait(__lk, [=]{ return _M_state < _S_max_readers; });
+ _M_gate1.wait(__lk, [this]{ return _M_state < _S_max_readers; });
++_M_state;
}
@@ -690,13 +690,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
unique_lock<mutex> __lk(_M_mut);
if (!_M_gate1.wait_until(__lk, __abs_time,
- [=]{ return !_M_write_entered(); }))
+ [this]{ return !_M_write_entered(); }))
{
return false;
}
_M_state |= _S_write_entered;
if (!_M_gate2.wait_until(__lk, __abs_time,
- [=]{ return _M_readers() == 0; }))
+ [this]{ return _M_readers() == 0; }))
{
_M_state ^= _S_write_entered;
// Wake all threads blocked while the write-entered flag was set.
@@ -716,7 +716,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
unique_lock<mutex> __lk(_M_mut);
if (!_M_gate1.wait_until(__lk, __abs_time,
- [=]{ return _M_state < _S_max_readers; }))
+ [this]{ return _M_state < _S_max_readers; }))
{
return false;
}
--
2.46.1