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 049A4385773D for ; Sat, 9 Mar 2024 12:27:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 049A4385773D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 049A4385773D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709987262; cv=none; b=sR0niIqX0zJs6CN5syeYdjiv1NEVbEzesMxMm0Alig7BCIcZtBsBn898MhG//OPmooYnJxLuBRvcndVztwr/4jVxLtwadMXcdc0xIQUYqARn1MNgyqmSg2vnLSPH6O/uyCYMj4jai7FUwwphJY+WrlMXh0oyvjNckwfBhTx+19c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709987262; c=relaxed/simple; bh=8G+4r/4oHtsIt5jHf9uWwRLx2yZq9YkEt9z6IGkYYTk=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=D2gBdFMf7W2ZhqyPX3wXIgNhwEwje42gAopoed+gWoFK+CIiVooW4e+9vfTQXYQNpv1VfCpcvpcy5nKA3EX1WFdhiH+J3nFLQnRLg/PG/XsQ9RuQUYcgRKoRjNfjRctXJDJ7QfgM+UCy8WVlkBWB2iSIm8TH7lCfxiiS0oCQpR4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709987259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7hcvGhEtvQNURre0P6Wn+jKw08j28OTBjN4ll7/y2tI=; b=jCmOxZi3Qm+FNwTh6ZVuqV8eCO4K/i5NhiwaXI+PA2eqADLobnxruGu3KYWUl8cI6nl91p wANj3rzt2V0yEjBnxpGkBWybIGpvKJQDtAWGy1Lv51nqhhEiAf/NXXCsuWZaOyP6PBfUI+ ODfFkdi5DwGStV7nszPLUBisa2zVsLI= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-EiaCvhm0NiqGsTqtFciu6Q-1; Sat, 09 Mar 2024 07:27:36 -0500 X-MC-Unique: EiaCvhm0NiqGsTqtFciu6Q-1 Received: by mail-yb1-f198.google.com with SMTP id 3f1490d57ef6-dcd1779adbeso5542883276.3 for ; Sat, 09 Mar 2024 04:27:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709987255; x=1710592055; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7hcvGhEtvQNURre0P6Wn+jKw08j28OTBjN4ll7/y2tI=; b=CrJI/l2UgphesgQL7v4qSvJ4UxGb2xk4oyFGefL+5SSor/kCVmWM2LVFIIqnhku1Vz fIOQRQ3o2U2rjxIzc4OqFKn6ktbLeqGt2FfdOcBeFpil4Znd1SGUauMlOwaDO1LB/kBD wsCFuPqbcSoG7BV3oRDTURayErzAJdXLm6vTJ8k53j63LIE+OBLC+5c3B9Pmj2wzfnrx kZR+ugfM9DfuG+kAqPcsbKBZ0cK1aDka7u7MucIWOWRQ+odcb5ILXXqvAUdTZISGEdO+ zgAEch8tCYDMhdu43vGRd4PeD2W+af+BH/5HqJIDTicK3F4UjDWHRtl3TP9eQVipDvVP maOA== X-Gm-Message-State: AOJu0YzR/6gu6rUjRuM30honM4842kKmEcR5OC1dOA5ESZSaYdUpaSAZ heY8CKaWJszDy3CIKBxkliug9wUvAkGAfxJAQuLPbOcYq5ltYS57ZEriLDcwJ2V929iB9eLqL1A YVm8D2H/jB2ZPJwaGC2nQjHVAY+9JDnUkAEadlTXCO+k+tjJnnTby7mciJ3vBBXIC1GPmDbozxq DcyEZDLSXL9f8GBWXatnmpN91MXIsTe3kb0nwY+A== X-Received: by 2002:a25:9182:0:b0:dc6:ce0e:ad47 with SMTP id w2-20020a259182000000b00dc6ce0ead47mr914772ybl.56.1709987255772; Sat, 09 Mar 2024 04:27:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFqkiLpDMgkcoetTHAhNOvCIt8MTld0xxMOYTrOCo9COI6kf0l9qq5d2Q5GgsJMVeD7ZpZRtIveryoS/kIQNc= X-Received: by 2002:a25:9182:0:b0:dc6:ce0e:ad47 with SMTP id w2-20020a259182000000b00dc6ce0ead47mr914771ybl.56.1709987255502; Sat, 09 Mar 2024 04:27:35 -0800 (PST) MIME-Version: 1.0 References: <20231116134736.1287539-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Sat, 9 Mar 2024 12:27:19 +0000 Message-ID: Subject: Re: [PATCH 1/2] libstdc++: Atomic wait/notify ABI stabilization To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Thomas Rodgers , Nate Eldredge X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000ef6d090613396eff" X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000ef6d090613396eff Content-Type: text/plain; charset="UTF-8" On Sat, 9 Mar 2024 at 12:18, Jonathan Wakely wrote: > > > > + template >> + __wait_result_type >> + __wait_for(const __platform_wait_t* __addr, __wait_args __args, >> + const chrono::duration<_Rep, _Period>& __rtime) noexcept >> + { >> + if (!__rtime.count()) >> + // no rtime supplied, just spin a bit >> + return __detail::__wait_impl(__addr, __args | >> __wait_flags::__spin_only); >> > > This should set __do_spin | __spin_only if the latter no longer implies > the former. > > >> >> + enum class __wait_flags : uint32_t >> { >> > > >> + __abi_version = 0, >> + __proxy_wait = 1, >> + __track_contention = 2, >> + __do_spin = 4, >> + __spin_only = 8 | __do_spin, // implies __do_spin >> > > This should be just 8 and not also imply __do_spin. > Alternatively, we could have: __spin_only = 4, __spin_then_wait = 8, __do_spin = __spin_only | __spin_then_wait, Then testing (flags & do_spin) would be true if either of the others is set, but (flags & spin_only) would do the right thing. But if we have spin_then_wait in the default flags, a caller that wants to use spin_only has to clear the spin_then_wait flag, otherwise there are two mutually exclusive flags set at once. I think I prefer: __do_spin = 4, __spin_only = 8, // Ignored unless __do_spin is also set. as this is simpler for callers. --000000000000ef6d090613396eff--