mirror of git://gcc.gnu.org/git/gcc.git
![]() Previously, atomic<shared_ptr<T>>::wait (and the weak_ptr version) was equivalent to waiting directly on _M_val, which corresponds to the pointer to the control block (_M_pi). Consequently, wakeups were not triggered if the stored pointer value was changed to a pointer that uses the same control block but stores pointer to a different object. Such a pointer can be constructed using an aliasing constructor. To address this, wait now uses a generic proxy wait std::__atomic_wait_address function, which supports waiting until any predicate is satisfied. The provided predicate now compares both the control block (_M_pi) and the stored pointer (_M_ptr). Comparing the latter requires locking the pointer. Since this function operates on raw pointers, the type of _M_val was changed from __atomic_base<uintptr_t> to uintptr_t. Invocations of the corresponding member functions are now replaced with direct use of __atomic builtins. PR libstdc++/118757 libstdc++-v3/ChangeLog: * include/bits/shared_ptr_atomic.h (_Atomic_count::_M_wait_unlock): Add parameter capturing reference to _M_ptr. Reimplement in terms of __atomic_wait_address. (_Atomic_count::~_Atomic_count, _Atomic_count::lock) (_Atomic_count::unlock, _Atomic_count::_M_swap_unlock): Replace invocation of atomic member funcitons with __atomic builtins. (_Atomic_count::notify_one, _Atomic_count::notify_all): Use __atomic_notify_address. (_Sp_atomic::element_type): Define. (_Sp_atomic::_M_val): Change type to uintptr_t. (_Sp_atomic::wait): Pass _M_ptr to _M_wait_unlock. * python/libstdcxx/v6/printers.py: * testsuite/20_util/shared_ptr/atomic/pr118757.cc: New test. * testsuite/20_util/weak_ptr/pr118757.cc: New test. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com> |
||
---|---|---|
.. | ||
config | ||
doc | ||
include | ||
libsupc++ | ||
po | ||
python | ||
scripts | ||
src | ||
testsuite | ||
.editorconfig | ||
ChangeLog | ||
ChangeLog-1998 | ||
ChangeLog-1999 | ||
ChangeLog-2000 | ||
ChangeLog-2001 | ||
ChangeLog-2002 | ||
ChangeLog-2003 | ||
ChangeLog-2004 | ||
ChangeLog-2005 | ||
ChangeLog-2006 | ||
ChangeLog-2007 | ||
ChangeLog-2008 | ||
ChangeLog-2009 | ||
ChangeLog-2010 | ||
ChangeLog-2011 | ||
ChangeLog-2012 | ||
ChangeLog-2013 | ||
ChangeLog-2014 | ||
ChangeLog-2015 | ||
ChangeLog-2016 | ||
ChangeLog-2017 | ||
ChangeLog-2018 | ||
ChangeLog-2019 | ||
ChangeLog-2020 | ||
ChangeLog-2021 | ||
ChangeLog-2022 | ||
ChangeLog-2023 | ||
ChangeLog-2024 | ||
Makefile.am | ||
Makefile.in | ||
README | ||
acinclude.m4 | ||
aclocal.m4 | ||
config.h.in | ||
configure | ||
configure.ac | ||
configure.host | ||
crossconfig.m4 | ||
fragment.am | ||
linkage.m4 |
README
file: libstdc++-v3/README New users may wish to point their web browsers to the file index.html in the 'doc/html' subdirectory. It contains brief building instructions and notes on how to configure the library in interesting ways.