[{"id":3683901,"web_url":"http://patchwork.ozlabs.org/comment/3683901/","msgid":"<CACb0b4nOexJ_J=Uhf7KJ1VnJTnDqLexa-t=ZSN7v+x2toavuNw@mail.gmail.com>","list_archive_url":null,"date":"2026-04-29T08:32:27","subject":"Re: [PATCH] testsuite: semaphore/try_acquire_until: reorder\n clock::now calls","submitter":{"id":48004,"url":"http://patchwork.ozlabs.org/api/people/48004/","name":"Jonathan Wakely","email":"jwakely@redhat.com"},"content":"On Wed, 29 Apr 2026 at 02:51, Alexandre Oliva <oliva@adacore.com> wrote:\n>\n>\n> Clock calls on VxWorks are slow, so the odds that the consecutive\n> calls of *clock::now() will yield a different result are not\n> negligible.  Reordering the calls avoids false positives.\n>\n> Regstrapped on x86_64-linux-gnu.  Also tested on ppc-vx7r2 with gcc-15,\n> with an analogous patch for try_acquire_posix.cc.  Ok to install?\n\nOK for trunk (and branches if you want, but wait until after 16.1 is released).\n\n>\n>\n> for  libstdc++-v3/ChangeLog\n>\n>         * testsuite/30_threads/semaphore/try_acquire_until.cc\n>         (test01): Reorder calls.\n> ---\n>  .../30_threads/semaphore/try_acquire_until.cc      |    2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc\n> index 44b2b90431a41..dea8c53a5a02f 100644\n> --- a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc\n> +++ b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc\n> @@ -43,8 +43,8 @@ void test01()\n>    }\n>\n>    {\n> -    auto const at = std::chrono::system_clock::now() + dur;\n>      auto const t0 = std::chrono::steady_clock::now();\n> +    auto const at = std::chrono::system_clock::now() + dur;\n>      VERIFY( !s.try_acquire_until(at) );\n>      auto const diff = std::chrono::steady_clock::now() - t0;\n>      VERIFY( diff >= dur );\n>\n>\n> --\n> Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/\n> Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer\n> More tolerance and less prejudice are key for inclusion and diversity.\n> Excluding neuro-others for not behaving \"\"normal\"\" is *not* inclusive!\n>","headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=T88yPBTc;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=T88yPBTc","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g59Yc1vbkz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 18:33:22 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id E56214B99F64\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 08:33:20 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id E73184B99F60\n for <gcc-patches@gcc.gnu.org>; Wed, 29 Apr 2026 08:32:46 +0000 (GMT)","from mail-yx1-f72.google.com (mail-yx1-f72.google.com\n [74.125.224.72]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-190-sjXLozCSO2ifIJtMCgGbBw-1; Wed, 29 Apr 2026 04:32:44 -0400","by mail-yx1-f72.google.com with SMTP id\n 956f58d0204a3-6596b8ee4b4so6820118d50.0\n for <gcc-patches@gcc.gnu.org>; Wed, 29 Apr 2026 01:32:44 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org E56214B99F64","OpenDKIM Filter v2.11.0 sourceware.org E73184B99F60"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org E73184B99F60","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org E73184B99F60","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777451567; cv=none;\n b=pO5tYKfv2hgUB5wM1NhbUYWRZSLdoQTfxdBY1+zo5HWjEFM3cQqTq7r+9wwqYoNx8Rz8WhMP3KD5skW6fTIdmTDicJL3gatIzq5zFXAGQDZqJbPQ3SQ++Obzih6hNe2mD9rtph0XTW1FNckXlER9StKqqzfxwCkNhGPxgzYJtuM=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777451567; c=relaxed/simple;\n bh=9BraS0qc+pygAWE1tIxtdxwKPQNX/98N8rHsfBt8dmA=;\n h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;\n b=XuOzF62W9O70nrjPAadgwEK1etPEPGqi0hFP3SqdqLg32/5eyvIcpWVbolx+A8wqAU9WyjkC9XrK6Pj9ZOXxHhdSCxed92vyJ1HcO0rOCR9dvuA/wWush/0hIzzD+XbGse7jUjjwBbpE3oOcMd+rW7Nk+3H9og5Ku0vU922hJeo=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777451566;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=A6eMTUSDKaItbsMX4mDWfBPFSaZYt64mEl7sjzxy/eA=;\n b=T88yPBTcw90YGpOoVrWjWrHJkzi8Ye573N/uJWeqlVOxK5mAVLCte80sWKPqWptXS5Sd+L\n lFvK33GB9E2/4WRPo7TadNw+nFFzwbk39aD/6Atk9N8Dg2Ryp1ST6Fy3PGMKWTPVMZ+d8m\n fCoyo6g/aL9ntKtFz5ayzBvr+J7D/eU=","X-MC-Unique":"sjXLozCSO2ifIJtMCgGbBw-1","X-Mimecast-MFC-AGG-ID":"sjXLozCSO2ifIJtMCgGbBw_1777451564","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777451564; x=1778056364;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=A6eMTUSDKaItbsMX4mDWfBPFSaZYt64mEl7sjzxy/eA=;\n b=UFRiN2avi0HH8R3HOrhEQk4JnmQ6FlTp6cAG+7mZRzfOrp9osSX1NPQxzj3FAFR9pN\n 0CpJFDqJ06VvwKlQlmRnkIdvJvkj86HfyGR21jxE3gUaCIrIG+Vxox3vLDdOwudGHdRO\n SueujhhyUa8vKPVlyi/8dJJUE7wwt7g/TUgpC9vt81TRyMCjtufIm/ZmaTZ7g/0Inztu\n 9U0rlcWnjGdg+S4JipnLmUEKTFac4TWbi76tErumEOx2wLhgNGWQrLo0JmvIHocBW8lJ\n dHujoXhSLezXVWq/ZTEhf8qawaATtI38jA3qOPIN3fAEEkZ8W4NtndvC8tHQezILMFk5\n ksZg==","X-Gm-Message-State":"AOJu0Yzt7rHe/UQPsR/OBC7IhDzHHoNgl5AMeSwb8TD03pCOCHR5tHo0\n RqvzhJbkA1qO/pgP+a8BzzGCC5xxRI3+gz55r9LfsFOTraPSwFiHwTOEc/FgEQxFuso3bcifyxg\n x3e7vyiow6vzTa2ijnhcn5tBfGiRaZ5Dyqid13lZq8EaEPMXSeKtlFoM6O6Ni0Jgas+6ACDxXUK\n +zPW8p6du+CPD96eISBUk/VyVbaKaxtO5Qgw==","X-Gm-Gg":"AeBDietC0LgaG+To2LNSqxDhgnaiEMryPmUzTI2oRPYdgmwXOCLs1BdCLIWpTu8Z9wF\n DtHmmuthgRjvggBIvSc0nTam5wEMekhTkq0jvh2SQNUA6ujBey1Ptal0vx8BK0Gwvc8iSr3aVcQ\n +Y+FpPp3KY5zNN9sAZlDh1qVhZ63qH4WD8AEbLkdymeZ+7jItjR5V1qSEmRT55FEpj4uoFpK2+c\n qyUTcUAihOYEIg+A48dSpofwmVXQqbyT6njxz8tioJHSIk6hJFmFlb4WHBi3mdzLK33d17cEZfs\n VQ==","X-Received":["by 2002:a05:690e:1b5d:b0:651:db4c:8066 with SMTP id\n 956f58d0204a3-65beee42f5cmr4241356d50.39.1777451564181;\n Wed, 29 Apr 2026 01:32:44 -0700 (PDT)","by 2002:a05:690e:1b5d:b0:651:db4c:8066 with SMTP id\n 956f58d0204a3-65beee42f5cmr4241343d50.39.1777451563673; Wed, 29 Apr 2026\n 01:32:43 -0700 (PDT)"],"MIME-Version":"1.0","References":"<ormrymmt7w.fsf@lxoliva.fsfla.org>","In-Reply-To":"<ormrymmt7w.fsf@lxoliva.fsfla.org>","From":"Jonathan Wakely <jwakely@redhat.com>","Date":"Wed, 29 Apr 2026 09:32:27 +0100","X-Gm-Features":"AVHnY4IoQ3au0qDpwWEEFXsCIi-4PttCtYiKfZ0AOmsg320050KgIMXlkxipto8","Message-ID":"\n <CACb0b4nOexJ_J=Uhf7KJ1VnJTnDqLexa-t=ZSN7v+x2toavuNw@mail.gmail.com>","Subject":"Re: [PATCH] testsuite: semaphore/try_acquire_until: reorder\n clock::now calls","To":"Alexandre Oliva <oliva@adacore.com>","Cc":"gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"6Y9S1OrMhYXvkTKVdhtBimgDbEDQSXn0HswNoNjFIsw_1777451564","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=\"UTF-8\"","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}}]