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

--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Thomas Rodgers <rodge...@gcc.gnu.org>:

https://gcc.gnu.org/g:7c21556daf385fe9ece37319f574776dd7d8ab1c

commit r12-8231-g7c21556daf385fe9ece37319f574776dd7d8ab1c
Author: Thomas W Rodgers <trodg...@redhat.com>
Date:   Fri Apr 22 15:46:19 2022 -0700

    libstdc++: Make atomic notify_one and notify_all non-const

    <recording this here for future reference>
    PR102994 "atomics: std::atomic<ptr>::wait is not marked const" raises the
    issue that the current libstdc++ implementation marks the notify members
    const, the implementation strategy used by libstdc++, as well as libc++
    and the Microsoft STL, do not require the atomic to be mutable (it is hard
    to conceive of a desirable implementation approach that would require it).
    The original paper proposing the wait/notify functionality for atomics
    (p1185) also had these members marked const for the first three revisions,
    but that was changed without explanation in r3 and subsequent revisions of
    the paper.

    After raising the issue to the authors of p1185 and the author of the
    libc++ implementation, the consensus seems to be "meh, it's harmless" so
    there seems little appetite for an LWG issue to revisit the subject.

    This patch changes the libstdc++ implementation to be in agreement with
    the standard by removing const from those notify_one/notify_all members.

    libstdc++-v3/ChangeLog:

            PR libstdc++/102994
            * include/bits/atomic_base.h (atomic_flag::notify_one,
            notify_all): Remove const qualification.
            (__atomic_base::notify_one, notify_all): Likewise.
            * include/std/atomic (atomic<bool>::notify_one, notify_all):
            Likewise.
            (atomic::notify_one, notify_all): Likewise.
            (atomic<T*>::notify_one, notify_all): Likewise.
            (atomic_notify_one, atomic_notify_all): Likewise.
            * testsuite/29_atomics/atomic/wait_notify/102994.cc: Adjust test
            to account for change in notify_one/notify_all signature.

Reply via email to