* testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Template test functions and use them to test both steady_clock and system_clock. --- libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc index 12ee52f..6355d8f 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc @@ -49,18 +49,26 @@ struct clock std::timed_mutex mx; bool locked = false; +template <typename ClockType> void f() { - locked = mx.try_lock_until(clock::now() + C::milliseconds(1)); + locked = mx.try_lock_until(ClockType::now() + C::milliseconds(1)); } -int main() +template <typename ClockType> +void test() { std::lock_guard<std::timed_mutex> l(mx); - auto start = C::system_clock::now(); - std::thread t(f); + auto start = ClockType::now(); + std::thread t(f<ClockType>); t.join(); - auto stop = C::system_clock::now(); + auto stop = ClockType::now(); VERIFY( (stop - start) < C::seconds(9) ); VERIFY( !locked ); } + +int main() +{ + test<C::system_clock>(); + test<C::steady_clock>(); +} -- git-series 0.9.1