diff options
author | Mike Crowe <mac@mcrowe.com> | 2018-09-25 14:59:27 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-09-25 15:59:27 +0100 |
commit | 29b26763f5552129996bfc732cfa2087d7c9657c (patch) | |
tree | 1d265f68cd21caedae6be5605e63d2b06c8fd815 /libstdc++-v3 | |
parent | 16d30bbd4dae88ceb08bf8b965c8fd61b25b558c (diff) | |
download | gcc-29b26763f5552129996bfc732cfa2087d7c9657c.tar.gz |
Use steady_clock to implement condition_variable::wait_for with predicate
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.
2018-09-25 Mike Crowe <mac@mcrowe.com>
* include/std/condition_variable (condition_variable::wait_for): Use
steady clock in overload that uses a predicate.
From-SVN: r264575
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/std/condition_variable | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 67b3eb4a94e..611d43ac1bb 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2018-09-25 Mike Crowe <mac@mcrowe.com> + + * include/std/condition_variable (condition_variable::wait_for): Use + steady clock in overload that uses a predicate. + 2018-09-25 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/87431 diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable index 1f84ea324eb..84173012b5b 100644 --- a/libstdc++-v3/include/std/condition_variable +++ b/libstdc++-v3/include/std/condition_variable @@ -158,11 +158,12 @@ _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 |