On RHEL 7.6 ARM I see this with the lock returning false
but without the 11 second timeout. Try adding some sleeps.
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);