[PATCH] testsuite: semaphore/try_acquire_until: reorder clock::now calls
Jonathan Wakely
jwakely@redhat.com
Wed Apr 29 08:32:27 GMT 2026
On Wed, 29 Apr 2026 at 02:51, Alexandre Oliva <oliva@adacore.com> wrote:
>
>
> Clock calls on VxWorks are slow, so the odds that the consecutive
> calls of *clock::now() will yield a different result are not
> negligible. Reordering the calls avoids false positives.
>
> Regstrapped on x86_64-linux-gnu. Also tested on ppc-vx7r2 with gcc-15,
> with an analogous patch for try_acquire_posix.cc. Ok to install?
OK for trunk (and branches if you want, but wait until after 16.1 is released).
>
>
> for libstdc++-v3/ChangeLog
>
> * testsuite/30_threads/semaphore/try_acquire_until.cc
> (test01): Reorder calls.
> ---
> .../30_threads/semaphore/try_acquire_until.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc
> index 44b2b90431a41..dea8c53a5a02f 100644
> --- a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc
> +++ b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc
> @@ -43,8 +43,8 @@ void test01()
> }
>
> {
> - auto const at = std::chrono::system_clock::now() + dur;
> auto const t0 = std::chrono::steady_clock::now();
> + auto const at = std::chrono::system_clock::now() + dur;
> VERIFY( !s.try_acquire_until(at) );
> auto const diff = std::chrono::steady_clock::now() - t0;
> VERIFY( diff >= dur );
>
>
> --
> Alexandre Oliva, happy hacker https://blog.lx.oliva.nom.br/
> Free Software Activist FSFLA co-founder GNU Toolchain Engineer
> More tolerance and less prejudice are key for inclusion and diversity.
> Excluding neuro-others for not behaving ""normal"" is *not* inclusive!
>
More information about the Libstdc++
mailing list