From: Paul Floyd Date: Fri, 3 Feb 2023 18:27:39 +0000 (+0100) Subject: DRD regtest: try to make timed_mutex more reliable X-Git-Tag: VALGRIND_3_21_0~177 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=add5fe983292106d62196a77c57e9416c26ef1b8;p=thirdparty%2Fvalgrind.git 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. --- 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);