[gcc(refs/users/aoliva/heads/testme)] testsuite: semaphore/try_acquire_until: reorder clock::now calls
Alexandre Oliva
aoliva@gcc.gnu.org
Tue Apr 28 22:30:51 GMT 2026
https://gcc.gnu.org/g:937b4b0e1bb6ad0ee2aeaf4e3eee4646155d33a8
commit 937b4b0e1bb6ad0ee2aeaf4e3eee4646155d33a8
Author: Alexandre Oliva <oliva@adacore.com>
Date: Tue Apr 28 16:01:47 2026 -0300
testsuite: semaphore/try_acquire_until: reorder clock::now calls
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.
for libstdc++-v3/ChangeLog
* testsuite/30_threads/semaphore/try_acquire_until.cc
(test01): Reorder calls.
Diff:
---
libstdc++-v3/testsuite/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 44b2b90431a4..dea8c53a5a02 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 );
More information about the Libstdc++-cvs
mailing list