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.129.124]) by sourceware.org (Postfix) with ESMTPS id CF83E385841B for ; Fri, 11 Feb 2022 20:22:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CF83E385841B Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-541-gGw5SXXANFa4LCFdB82Www-1; Fri, 11 Feb 2022 15:22:45 -0500 X-MC-Unique: gGw5SXXANFa4LCFdB82Www-1 Received: by mail-yb1-f199.google.com with SMTP id a32-20020a25ae20000000b0061db8f89e46so21080166ybj.14 for ; Fri, 11 Feb 2022 12:22:45 -0800 (PST) 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=Cgr8SwqP8yJiyVMih0JDby8UVcVFdcSUgsKOgkO8YnE=; b=dIyq+JojxlpAyYEAatRkI8mjz2WVg2gyPBgQzUc3AemtO5ONAutYjh6tyjbXYlU0KN KUduDFCVyHaIC1M/Zv0qMBxCgFNbg+bnBtLabebYgLLC6EHpX73ucZyn0y1UjD9nB07S uJjhlIQhF4sA+hiW64V92vkzDMZGNmjB35PcU2eW0t5shNUimlL198PW+soXYcUj1Yuq E1xf6wA+n8XfQjPpAyST8LaMQ9yxNHsOMWYWTIwvychoW7fxJxsgN1oAo4q9K/czzyjy dA0fHBkccRGOEwDxIawnPpjde/+/iXhSU0AnkC3DQU2u7cFgSx+oKmqtwceG874jpP1F qL9w== X-Gm-Message-State: AOAM5327Z3AGd35/bweWdN5T1n+Msi7Hh6WLL0Wd2i/ULC9nsNFRSKbT kqFCGD2deJZ9UTbse17i/4/1qeCLP2YDajIXOPI6YWfvRdlPtal1ptu7jzGPrLASjDkfIt7HiXY BvwinLYGf5bLeTscmg/q2x5JjYxoH5bU= X-Received: by 2002:a25:df48:: with SMTP id w69mr3121408ybg.13.1644610964754; Fri, 11 Feb 2022 12:22:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdj4QmLbBNhBsYh2KGnOJb8Sbnz7gkqwGuWXZgg5/iYMlV+kZxu05FD2dDn226FhmpyhM08TfewUndCIwQxjY= X-Received: by 2002:a25:df48:: with SMTP id w69mr3121392ybg.13.1644610964519; Fri, 11 Feb 2022 12:22:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Fri, 11 Feb 2022 20:22:33 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: Make atomic notify_one and notify_all non-const To: Thomas Rodgers Cc: "libstdc++" , gcc Patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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, 11 Feb 2022 20:22:48 -0000 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.