[PATCH] libstdc++: Fix semaphore to work with system_clock timeouts
Fri Apr 23 06:47:55 GMT 2021
On Thu, Apr 22, 2021 at 8:48 PM Jonathan Wakely via Gcc-patches
> The __cond_wait_until_impl function takes a steady_clock timeout, but
> then sometimes tries to compare it to a time from the system_clock,
> which won't compile. Additionally, that function gets called with
> system_clock timeouts, which also won't compile. This makes the function
> accept timeouts for either clock, and compare to the time from the right
> This fixes the compilation error that was causing two tests to fail on
> non-futex targets, so we can revert the r12-11 change to disable them.
> * include/bits/atomic_timed_wait.h (__cond_wait_until_impl):
> Handle system_clock as well as steady_clock.
> * testsuite/30_threads/semaphore/try_acquire_for.cc: Re-enable.
> * testsuite/30_threads/semaphore/try_acquire_until.cc:
> I'm testing this now on x86_64-linux, powerpc64le-linux, sparc-linux,
> power-aix and sparc-solaris. It looks good so far, so I'll push to
> trunk when the tests finish.
> This should also go to the gcc-11 branch, or the timed waits for
> semaphores can't be used with system_clock times on non-futed targets.
Fine with me.
More information about the Libstdc++