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

--- Comment #7 from Thomas Rodgers <rodgertq at gcc dot gnu.org> ---
(In reply to Óscar Fuentes from comment #6)
> (In reply to Jonathan Wakely from comment #5)
> > (In reply to Óscar Fuentes from comment #4)
> > > The fix is wrong. It changes atomic_notify_one and atomic_notify_all 
> > > instead
> > > of atomic<>::wait.
> > 
> > It changed both.
> > 
> > > So right now atomic<>::wait remains unfixed
> > 
> > Are you sure?
> 
> Sigh. Sorry. It would be nice if the commit message mentioned the change to
> atomic_notify_* and its motivation, though.
>  
> > > and atomic_notify_(one|all) arg
> > > is wrongly marked as const.
> > 
> > This will be the subject of a library issue, potentially fixing the
> > standard. The notify functions should be const too.
> 
> So IIUC you are applying modifications to libstdc++ that deviate from the
> published standard expecting that the committee will accept those changes.
> As a user, this is troublesome, because right now I need to special-case gcc
> version >11.2 and maybe version <X.xx again in the future if the change is
> not accepted and is reverted.

There is an ongoing discussion between myself and the SG1,LWG, and LEWG chairs
(two of which were authors of p1135 which proposes atomic wait/notify) as to
whether there is a wording issue with the standard.

None of the three major standard library implementations require (as a matter
of implementation detail) notify_one/notify_all to be non-const, and indeed the
early wording of p1135 had them marked const. Between r2 and r3 of p1135 this
was changed, it'cites the minutes of an LEWG discussion as part of the change
rationale, but the minutes of that discussion do not give the motivation for
the change.

One argument is that you would typically wait in a const context and notify in
a non-const context, but by that rationale, the constness of atomic_ref::notify
is somewhat weird.

Reply via email to