public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-6708] libstdc++: Fix std::atomic<std::shared_ptr<T>> for AIX [PR104101] Date: Wed, 19 Jan 2022 01:03:15 +0000 (GMT) [thread overview] Message-ID: <20220119010315.87C4E3858409@sourceware.org> (raw) 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);
reply other threads:[~2022-01-19 1:03 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220119010315.87C4E3858409@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).