1. Introduction
[P1135] added the member
functions
,
, and
to
, but did not add those same member
functions to
or
due to
an oversight. This paper takes care of that, bringing the interfaces
of
and
back in line
with that of
.
2. Changelog
Revision 0: Initial version.
3. Wording
Note: The following changes are relative to the post Kona 2019 working draft of ISO/IEC 14882, ([N4810]), with the changes from [P1135R5] merged in.
Modify the class synopsis in [util.smartptr.atomic.shared] as follows:
namespace std { template < class T > struct atomic < shared_ptr < T >> { // ... bool compare_exchange_strong ( shared_ptr < T >& expected , shared_ptr < T > desired , memory_order order = memory_order :: seq_cst ) noexcept ;
void wait ( shared_ptr < T > old , memory_order order = memory_order :: seq_cst ) const noexcept ; void notify_one () noexcept ; void notify_all () noexcept ;
constexpr atomic () noexcept = default ; // ...
Add the following to the end of [util.smartptr.atomic.shared]:
void wait ( shared_ptr < T > old , memory_order order = memory_order :: seq_cst ) const noexcept ; Expects:is neither
order nor
memory_order :: release .
memory_order :: acq_rel Effects: Repeatedly performs the following steps, in order:
Evaluates
and compares it to
load ( order ) .
old If the two are not equivalent, returns.
Blocks until it is unblocked by an atomic notifying operation or is unblocked spuriously.
Remarks: Twoobjects are equivalent if they store the same pointer and either share ownership or are both empty. This function is an atomic waiting operation ([atomics.wait]).
shared_ptr void notify_one () noexcept ; Effects: Unblocks the execution of at least one atomic waiting operation that is eligible to be unblocked ([atomics.wait]) by this call, if any such atomic waiting operations exist.Remarks: This function is an atomic notifying operation ([atomics.wait]).void notify_all () noexcept ; Effects: Unblocks the execution of all atomic waiting operations that are eligible to be unblocked ([atomics.wait]) by this call.Remarks: This function is an atomic notifying operation ([atomics.wait]).
Modify the class synopsis in [util.smartptr.atomic.weak] as follows:
namespace std { template < class T > struct atomic < weak_ptr < T >> { // ... bool compare_exchange_strong ( weak_ptr < T >& expected , weak_ptr < T > desired , memory_order order = memory_order :: seq_cst ) noexcept ;
void wait ( weak_ptr < T > old , memory_order order = memory_order :: seq_cst ) const noexcept ; void notify_one () noexcept ; void notify_all () noexcept ;
constexpr atomic () noexcept = default ; // ...
Add the following to the end of [util.smartptr.atomic.weak]:
void wait ( weak_ptr < T > old , memory_order order = memory_order :: seq_cst ) const noexcept ; Expects:is neither
order nor
memory_order :: release .
memory_order :: acq_rel Effects: Repeatedly performs the following steps, in order:
Evaluates
and compares it to
load ( order ) .
old If the two are not equivalent, returns.
Blocks until it is unblocked by an atomic notifying operation or is unblocked spuriously.
*Remarks: Twoobjects are equivalent if they store the same pointer and either share ownership or are both empty. This function is an atomic waiting operation ([atomics.wait]).
weak_ptr void notify_one () noexcept ; Effects: Unblocks the execution of at least one atomic waiting operation that is eligible to be unblocked ([atomics.wait]) by this call, if any such atomic waiting operations exist.Remarks: This function is an atomic notifying operation ([atomics.wait]).void notify_all () noexcept ; Effects: Unblocks the execution of all atomic waiting operations that are eligible to be unblocked ([atomics.wait]) by this call.Remarks: This function is an atomic notifying operation ([atomics.wait]).