public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Thomas Rodgers <trodgers@redhat.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
	gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++: Make atomic notify_one and notify_all non-const
Date: Fri, 11 Feb 2022 20:22:33 +0000	[thread overview]
Message-ID: <CACb0b4=kYEd6EmUPii02R4KrE76GMt74EMnKZWM4GuWYO_Mpqw@mail.gmail.com> (raw)
In-Reply-To: <CAMmuTO_HPtJy-S7XjJxCMsZg1a8FvdxykS6Jtit6Ts40aqru8A@mail.gmail.com>

On Fri, 11 Feb 2022 at 17:40, Thomas Rodgers via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> <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:

Might as well add a "PR libstdc++/102994" here to the bug gets updated
automatically.

OK for trunk with that change.

>         * 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.
>
> Tested x86_64-pc-linux-gnu.


  reply	other threads:[~2022-02-11 20:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 17:39 Thomas Rodgers
2022-02-11 20:22 ` Jonathan Wakely [this message]
2022-04-22 22:55   ` Thomas Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACb0b4=kYEd6EmUPii02R4KrE76GMt74EMnKZWM4GuWYO_Mpqw@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=trodgers@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).