[PATCH] Use steady_clock to implement condition_variable::wait_for with predicate
Mike Crowe
mac@mcrowe.com
Wed Sep 12 14:35:00 GMT 2018
In r263225 (d2e378182a12d68fe5caeffae681252662a2fe7b), I fixed
condition_variable::wait_for to use std::chrono::steady_clock for the wait.
Unfortunately, I failed to spot that the same fix is required for the
wait_for variant that takes a predicate too.
Reported-by: Tom Wood <tom.wood@redembedded.com>
---
libstdc++-v3/include/std/condition_variable | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable
index 1f84ea324eb..24b96e7c295 100644
--- a/libstdc++-v3/include/std/condition_variable
+++ b/libstdc++-v3/include/std/condition_variable
@@ -158,11 +158,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const chrono::duration<_Rep, _Period>& __rtime,
_Predicate __p)
{
- using __dur = typename __clock_t::duration;
+ using __dur = typename __steady_clock_t::duration;
auto __reltime = chrono::duration_cast<__dur>(__rtime);
if (__reltime < __rtime)
++__reltime;
- return wait_until(__lock, __clock_t::now() + __reltime, std::move(__p));
+ return wait_until(__lock, __steady_clock_t::now() + __reltime, std::move(__p));
}
native_handle_type
--
2.11.0
More information about the Gcc-patches
mailing list