|
From: Paul F. <pa...@so...> - 2023-02-03 18:29:09
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=add5fe983292106d62196a77c57e9416c26ef1b8 commit add5fe983292106d62196a77c57e9416c26ef1b8 Author: Paul Floyd <pj...@wa...> Date: Fri Feb 3 19:27:39 2023 +0100 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: --- 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); |