From add5fe983292106d62196a77c57e9416c26ef1b8 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 3 Feb 2023 19:27:39 +0100 Subject: [PATCH] DRD regtest: try to make timed_mutex more reliable On RHEL 7.6 ARM I see this with the lock returning false but without the 11 second timeout. Try adding some sleeps. --- drd/tests/timed_mutex.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drd/tests/timed_mutex.cpp b/drd/tests/timed_mutex.cpp index b1bb61efa6..fa7464ea5b 100644 --- a/drd/tests/timed_mutex.cpp +++ b/drd/tests/timed_mutex.cpp @@ -12,16 +12,19 @@ void f() auto now=std::chrono::steady_clock::now(); test_mutex.try_lock_until(now + std::chrono::seconds(11)); --global; + std::this_thread::sleep_for(std::chrono::seconds(1)); test_mutex.unlock(); } - + + int main() { global = 0; + std::thread t(f); + std::this_thread::sleep_for(std::chrono::seconds(1)); auto now=std::chrono::steady_clock::now(); test_mutex.try_lock_until(now + std::chrono::seconds(11)); ++global; - std::thread t(f); test_mutex.unlock(); t.join(); assert(global == 0); -- 2.43.5