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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 53394
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53394&action=edit
Proposed patch: Unblock atomic wait on non-futex platforms

    When using a mutex and condition variable, the notifying thread needs to
    increment _M_ver while holding the mutex lock, and the waiting thread
    needs to re-check after locking the mutex. This avoids a missed
    notification as described in the PR.

    By moving the increment of _M_ver to the base _M_notify we can make the
    use of the mutex local to the use of the condition variable, and
    simplify the code a little. We can use a relaxed store because the mutex
    already provides sequential consistency. Also we don't need to check
    whether __addr == &_M_ver because we know that's always true for
    platforms that use a condition variable, and so we also know that we
    always need to use notify_all() not notify_one().

Reply via email to