public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6708] libstdc++: Fix std::atomic<std::shared_ptr<T>> for AIX [PR104101]
@ 2022-01-19  1:03 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-01-19  1:03 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:c3861f79859d96777f86a24261fe639538fd2e1c

commit r12-6708-gc3861f79859d96777f86a24261fe639538fd2e1c
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 18 21:15:05 2022 +0000

    libstdc++: Fix std::atomic<std::shared_ptr<T>> for AIX [PR104101]
    
    This fixes an on AIX.
    
    The lock function currently just spins, which should be changed to use
    back-off, and maybe then _M_val.wait(__current) when supported.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/104101
            * include/bits/shared_ptr_atomic.h (_Sp_atomic::_Atomic_count::lock):
            Only use __thread_relax if __cpp_lib_atomic_wait is defined.

Diff:
---
 libstdc++-v3/include/bits/shared_ptr_atomic.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libstdc++-v3/include/bits/shared_ptr_atomic.h b/libstdc++-v3/include/bits/shared_ptr_atomic.h
index 50aa46370ca..35f781dc9a0 100644
--- a/libstdc++-v3/include/bits/shared_ptr_atomic.h
+++ b/libstdc++-v3/include/bits/shared_ptr_atomic.h
@@ -392,7 +392,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  auto __current = _M_val.load(memory_order_relaxed);
 	  while (__current & _S_lock_bit)
 	    {
+#if __cpp_lib_atomic_wait
 	      __detail::__thread_relax();
+#endif
 	      __current = _M_val.load(memory_order_relaxed);
 	    }
 
@@ -401,7 +403,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 						 __o,
 						 memory_order_relaxed))
 	    {
+#if __cpp_lib_atomic_wait
 	      __detail::__thread_relax();
+#endif
 	      __current = __current & ~_S_lock_bit;
 	    }
 	  return reinterpret_cast<pointer>(__current);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-19  1:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19  1:03 [gcc r12-6708] libstdc++: Fix std::atomic<std::shared_ptr<T>> for AIX [PR104101] Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).