Skip to content

std::atomic<std::shared_ptr>::wait does not seem to care about control block difference. Is this a bug? #3555

Answered by fsb4000
zwhfly asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks, it looks like a bug for me. https://eel.is/c++draft/util.smartptr.atomic.shared#lib:wait,atomic%3cshared_ptr%3cT%3e%3e

void wait(shared_ptr<T> old, memory_order order = memory_order::seq_cst) const noexcept;

Preconditions: order is neither memory_­order​::​release nor memory_­order​::​acq_­rel.

Effects: Repeatedly performs the following steps, in order:
    Evaluates load(order) and compares it to old.
    If the two are not equivalent, returns.
    Blocks until it is unblocked by an atomic notifying operation or is unblocked spuriously.

Remarks: Two shared_­ptr objects are equivalent if they store the same pointer and either share ownership or are both empty.

returns success…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zwhfly
Comment options

Answer selected by zwhfly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants