https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118757

Tomasz Kamiński <tkaminsk at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkaminsk at gcc dot gnu.org

--- Comment #2 from Tomasz Kamiński <tkaminsk at gcc dot gnu.org> ---
I am looking at https://eel.is/c++draft/atomics.wait#4 that defines what waits
are eligle for notication:
4 A call to an atomic waiting operation on an atomic object M is eligible to be
unblocked by a call to an atomic notifying operation on M if there exist side
effects X and Y on M such that:

    (4.1)
    the atomic waiting operation has blocked after observing the result of X,
    (4.2)
    X precedes Y in the modification order of M, and
    (4.3)
    Y happens before the call to the atomic notifying operation.

The `p.store({ q, nullptr });` seem to be good candidate to producing side
effect of Y, however there is no side effect `X` that `p.wait(q)` is observing.
In particular construction is not atomic operator per
https://eel.is/c++draft/util.smartptr.atomic#shared-2:
> Effects: Initializes the object with the value desired. Initialization is not 
> an atomic operation ([intro.multithread]).

Reply via email to