std::atomic_wait and its friends lack noexceptSection: 32.5.2 [atomics.syn] Status: C++23 Submitter: Jiang An Opened: 2022-07-25 Last modified: 2023-11-22
Priority: Not Prioritized
View other active issues in [atomics.syn].
View all other issues in [atomics.syn].
View all issues with C++23 status.
Discussion:
Currently function templates std::atomic_wait, std::atomic_wait_explicit,
std::atomic_notify_one, and std::atomic_notify_all are not noexcept
in the Working Draft, but the equivalent member functions are all noexcept. I think
these function templates should be specified as noexcept, in order to be consistent
with the std::atomic_flag_* free functions, the corresponding member functions, and
other std::atomic_* function templates.
noexcept
to them.
[2022-07-30; Daniel provides wording]
[2022-08-23; Reflector poll]
Set status to Tentatively Ready after six votes in favour during reflector poll.
"Technically there's a difference between these and the member functions - the pointer can be null - but we don't seem to have let that stop us from adding noexcept to the rest of these functions."
[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4910.
Modify 32.5.2 [atomics.syn], header <atomic> synopsis, as indicated:
[…]
template<class T>
void atomic_wait(const volatile atomic<T>*, typename atomic<T>::value_type) noexcept;
template<class T>
void atomic_wait(const atomic<T>*, typename atomic<T>::value_type) noexcept;
template<class T>
void atomic_wait_explicit(const volatile atomic<T>*, typename atomic<T>::value_type,
memory_order) noexcept;
template<class T>
void atomic_wait_explicit(const atomic<T>*, typename atomic<T>::value_type,
memory_order) noexcept;
template<class T>
void atomic_notify_one(volatile atomic<T>*) noexcept;
template<class T>
void atomic_notify_one(atomic<T>*) noexcept;
template<class T>
void atomic_notify_all(volatile atomic<T>*) noexcept;
template<class T>
void atomic_notify_all(atomic<T>*) noexcept;
[…]