From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 52C3B3858427 for ; Fri, 22 Apr 2022 22:55:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 52C3B3858427 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-GGjyorUXNKqVJQwatNmRAQ-1; Fri, 22 Apr 2022 18:55:57 -0400 X-MC-Unique: GGjyorUXNKqVJQwatNmRAQ-1 Received: by mail-oo1-f70.google.com with SMTP id z4-20020a4a9c84000000b00329c324ddb7so4595448ooj.22 for ; Fri, 22 Apr 2022 15:55:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G+tkiJmEDtl9uLUform27DWhfknmpQ1rHPjlt2/hRZg=; b=OmDHhERjRyB3GqrytyxMD0wFZcb+YSytmU3WJNa8UmPPEPm9FW3yEB568m7r1UOJ+F SLDy8dsPUGvWpNlgWwG6XH66wSI6lNpHtCI39mAC+n+MgIA/XTn9wu8St+1aB1Z8YWrc JPREmhtEJPCp579fAGPzrZGdodpVC9ntM22BgODo9kR8/leC5sdEc088QRD7Y8axhpzJ jXRcHTMdZY+xTF5CCeKcE+szKfLp1/7gDVPlDv/JgshvMMHsfFfLXLfk1Bq4Pko3JIgR EgRuX8U6GFEbReI93V7dtEidDhihVXP8e22mVTZpwDCvNuTMYSnn5F4D2P5G+iQ8BNEY eihA== X-Gm-Message-State: AOAM531MqRsAya9FsBp67vIOtwNGC/PyT4rihqHL2Vj4PewZmjymY3Om n/W+T1hKOmsWilFFPZz1jtRtkFa9wjoigYDXZl4RVuZD58A4x+AvWhj2tVJUlmjVJuFjtX9LsOJ tAvTmIxrEwZ7rnjwzvd6+sjRGZEVT5Lw= X-Received: by 2002:a05:6808:bd2:b0:323:603:f6f8 with SMTP id o18-20020a0568080bd200b003230603f6f8mr5341254oik.153.1650668156929; Fri, 22 Apr 2022 15:55:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFpfv9Z+14g20t/l71z5dnawwakvvnqc/DTWZ0gn4nXJCoNc7Fj5XAoG+z8YAEGJ3nSfdPthiv2dn46TWQ+zc= X-Received: by 2002:a05:6808:bd2:b0:323:603:f6f8 with SMTP id o18-20020a0568080bd200b003230603f6f8mr5341248oik.153.1650668156760; Fri, 22 Apr 2022 15:55:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Thomas Rodgers Date: Fri, 22 Apr 2022 15:55:45 -0700 Message-ID: Subject: Re: [PATCH] libstdc++: Make atomic notify_one and notify_all non-const To: Jonathan Wakely Cc: "libstdc++" , gcc Patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2022 22:56:00 -0000 Committed to trunk, backported to releases/gcc-11. On Fri, Feb 11, 2022 at 12:22 PM Jonathan Wakely wrote: > On Fri, 11 Feb 2022 at 17:40, Thomas Rodgers via Libstdc++ > wrote: > > > > > > PR102994 "atomics: std::atomic::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::notify_one, notify_all): > > Likewise. > > (atomic::notify_one, notify_all): Likewise. > > (atomic::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. > >