public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Rodgers <trodgers@redhat.com>
To: Jonathan Wakely <jwakely@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, 22 Apr 2022 15:55:45 -0700	[thread overview]
Message-ID: <CAMmuTO8QDLxu-i6rq6zorTHdY0qxoM3ZWT=qoi7upTyRMP-8HA@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4=kYEd6EmUPii02R4KrE76GMt74EMnKZWM4GuWYO_Mpqw@mail.gmail.com>

Committed to trunk, backported to releases/gcc-11.

On Fri, Feb 11, 2022 at 12:22 PM Jonathan Wakely <jwakely@redhat.com> wrote:

> 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-04-22 22:55 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
2022-04-22 22:55   ` Thomas Rodgers [this message]

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='CAMmuTO8QDLxu-i6rq6zorTHdY0qxoM3ZWT=qoi7upTyRMP-8HA@mail.gmail.com' \
    --to=trodgers@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /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).