On Thu, 29 May 2025 at 12:12, Jonathan Wakely <jwak...@redhat.com> wrote: > > This series complete Tom's work to refactor the C++20 atomic wait/notify > code, and includes several follow-up patches from me. The goal is to > move the core implementation pieces into libstdc++.so instead of > defining everything inline in the headers. This is a necessary step for > stabilizing C++20 support for GCC 16. > > This fixes: > > - PR 98749 - No precondition checks in <semaphore>, <latch> and <barrier> > - PR 99572 - std::counting_semaphore coalescing wakes > - PR 104928 - std::counting_semaphore on Linux can sleep forever > - PR 110854 - constructor of std::counting_semaphore is not constexpr > - PR 118395 - Constructor of std::barrier is not constexpr > - PR 99995 - should not include <unistd.h> in c++20 mode > > Not fixed: > > - PR 115955 - atomic<T>::wait _S_for uses a poor hash function > This can be fixed at leisure once the definition moves into the shared > library and isn't defined inline in headers. > > - PR 118402 - std::barrier doesn't use futex directly > See the bugzilla PR for discussion. > > All tests pass on x86_64-linux and sparc-solaris and power-aix. I'm not > expecting further review of this series, but I'm posting it one more > time before pushing because I want to see the Linaro CI results.
CI passed for arm and aarch64: https://patchwork.sourceware.org/project/gcc/patch/20250529111009.2383223-17-jwak...@redhat.com/ So I've pushed this series to trunk. > > > Jonathan Wakely (14): > libstdc++: Whitespace fixes in atomic wait/notify code > libstdc++: Various fixes for atomic wait/notify code > libstdc++: Fix race condition in new atomic notify code > libstdc++: Fix time_point conversion in atomic timed waits > libstdc++: Simplify futex wrapper functions for atomic wait/notify > libstdc++: Remove reinterpret_cast uses in atomic wait/notify > libstdc++: Rename __atomic_compare to __atomic_eq > libstdc++: Rename __waiter_pool_impl to __waitable_state > libstdc++: Move atomic wait/notify entry points into the library > libstdc++: Optimise std::latch::arrive_and_wait > libstdc++: Fix std::barrier for constant initialization [PR118395] > libstdc++: Create new base class of std::barrier<C> for non-dependent > code > libstdc++: Rewrite std::counting_semaphore base class [PR118494] > libstdc++: Define __wait_result_type for atomic waiting > > Thomas Rodgers (2): > libstdc++: Atomic wait/notify ABI stabilization > libstdc++: Pass __wait_args to internal API by const pointer > > libstdc++-v3/acinclude.m4 | 37 -- > libstdc++-v3/config.h.in | 4 - > libstdc++-v3/config/abi/pre/gnu.ver | 11 + > libstdc++-v3/configure | 60 +-- > libstdc++-v3/include/bits/atomic_timed_wait.h | 452 ++++------------ > libstdc++-v3/include/bits/atomic_wait.h | 495 ++++++------------ > libstdc++-v3/include/bits/semaphore_base.h | 235 +++------ > libstdc++-v3/include/bits/version.def | 2 +- > libstdc++-v3/include/bits/version.h | 2 +- > libstdc++-v3/include/std/barrier | 199 ++++--- > libstdc++-v3/include/std/latch | 26 +- > libstdc++-v3/include/std/semaphore | 32 +- > libstdc++-v3/src/c++20/Makefile.am | 2 +- > libstdc++-v3/src/c++20/Makefile.in | 4 +- > libstdc++-v3/src/c++20/atomic.cc | 485 +++++++++++++++++ > .../17_intro/headers/c++1998/49745.cc | 2 - > .../29_atomics/atomic/wait_notify/100334.cc | 7 +- > .../29_atomics/atomic_integral/wait_notify.cc | 8 +- > .../testsuite/30_threads/barrier/cons.cc | 6 + > .../testsuite/30_threads/barrier/lwg3898.cc | 45 ++ > .../testsuite/30_threads/semaphore/100806.cc | 2 +- > .../testsuite/30_threads/semaphore/cons.cc | 7 + > .../semaphore/platform_try_acquire_for.cc | 9 - > .../30_threads/semaphore/try_acquire_posix.cc | 153 ------ > libstdc++-v3/testsuite/util/testsuite_abi.cc | 1 + > 25 files changed, 1056 insertions(+), 1230 deletions(-) > create mode 100644 libstdc++-v3/src/c++20/atomic.cc > create mode 100644 libstdc++-v3/testsuite/30_threads/barrier/cons.cc > create mode 100644 libstdc++-v3/testsuite/30_threads/barrier/lwg3898.cc > create mode 100644 libstdc++-v3/testsuite/30_threads/semaphore/cons.cc > delete mode 100644 > libstdc++-v3/testsuite/30_threads/semaphore/platform_try_acquire_for.cc > delete mode 100644 > libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_posix.cc > > -- > 2.49.0 >