[Bug libstdc++/116586] All uses of absolute timeouts should correctly handle negative times

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 14 16:34:52 GMT 2025


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116586

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:e0525a6d2bba07d623424ab6f10a023de90e65a2

commit r16-4426-ge0525a6d2bba07d623424ab6f10a023de90e65a2
Author: Mike Crowe <mac@mcrowe.com>
Date:   Sun Sep 14 21:21:28 2025 +0100

    libstdc++: Add std::binary_semaphore tests for negative timeouts [PR116586]

    Add test cases to prove that negative timeouts are correctly handled by
    std::binary_semaphore (which is just an alias for
    std::counting_semaphore<1>).  The tests exercise cases that aren't
    problematic with the current code since system_clock is converted to
    steady_clock before calling __platform_wait_until() is called but they
    will protect against changes in the implementation reintroducing this
    bug.

    libstdc++-v3/ChangeLog:

            PR libstdc++/116586
            * testsuite/30_threads/semaphore/try_acquire_for.cc: Add tests.
            * testsuite/30_threads/semaphore/try_acquire_until.cc: Add
            tests.

    Signed-off-by: Mike Crowe <mac@mcrowe.com>


More information about the Gcc-bugs mailing list