From: Jonathan Wakely <r...@gcc.gnu.org> This series complete Tom's work to refactor the C++20 atomic wait/notify code. The goal is to make the implementation ready for some pieces to be moved into libstdc++.so instead of defining everything inline in the headers.
Also available for review at https://forge.sourceware.org/gcc/gcc-TEST/pulls/31 This fixes: - PR 99572 - std::counting_semaphore coalescing wakes - PR 104928 - std::counting_semaphore on Linux can sleep forever - PR 118395 - Constructor of std::barrier is not constexpr Partially fixed: - PR 98749 - No precondition checks in <semaphore>, <latch> and <barrier> Not fixed: - PR 115955 - atomic<T>::wait _S_for uses a poor hash function - PR 110854 - constructor of std::counting_semaphore is not constexpr - PR 118402 - std::barrier doesn't use futex directly All tests pass on x86_64-linux (although I should add more tests for the semaphore bugs in the first two PRs above). I see one remaining failure on sparc-solaris due to a timeout: FAIL: 30_threads/semaphore/try_acquire.cc -std=gnu++20 execution test I still need to analyze that. Thomas Rodgers (2): libstdc++: Atomic wait/notify ABI stabilization libstdc++: Pass __wait_args to internal API by const pointer Jonathan Wakely (8): 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++: 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++: Use safe integer comparisons in std::latch [PR98749] libstdc++: Optimise std::latch::arrive_and_wait libstdc++-v3/include/bits/atomic_timed_wait.h | 539 +++++++---------- libstdc++-v3/include/bits/atomic_wait.h | 552 +++++++++--------- libstdc++-v3/include/bits/semaphore_base.h | 53 +- libstdc++-v3/include/std/barrier | 6 +- libstdc++-v3/include/std/latch | 51 +- .../29_atomics/atomic/wait_notify/100334.cc | 4 +- .../29_atomics/atomic_integral/wait_notify.cc | 4 + 7 files changed, 583 insertions(+), 626 deletions(-) -- 2.47.1