The pthread_cond_clockwait function is available in glibc since the 2.30 release. If this function is available in the C library it can be used to fix PR libstdc++/41861 by supporting std::chrono::steady_clock properly with std::condition_variable. This means that code using std::condition_variable::wait_for or std::condition_variable::wait_until with std::chrono::steady_clock is no longer subject to timing out early or potentially waiting for much longer if the system clock is warped at an inopportune moment. If pthread_cond_clockwait is available then std::chrono::steady_clock is deemed to be the "best" clock available which means that it is used for the relative wait_for calls and absolute wait_until calls using user-defined clocks. Calls explicitly using std::chrono::system_clock continue to use CLOCK_REALTIME via __gthread_cond_timedwait. If pthread_cond_clockwait is not available then std::chrono::system_clock is deemed to be the "best" clock available which means that the previous suboptimal behaviour remains. 2019-09-04 Mike Crowe <mac@mcrowe.com> PR libstdc++/41861 * acinclude.m4 (GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT): Check for new pthread_cond_clockwait function. * configure.ac: Use GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT. * configure: Regenerate. * config.h.in: Regenerate. * include/std/condition_variable: (condition_variable): Rename __steady_clock_t typedef and add system_clock. Change __clock_t to be a typedef for the preferred clock to convert arbitrary other clocks to. [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT] (wait_until): Add a steady_clock overload. (wait_until): Change __clock_t overload to use system_clock. [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT] (__wait_until_impl): Add steady_clock overload that calls pthread_cond_clockwait. (__wait_until_impl): Change __clock_t overload to use system_clock. (condition_variable_any) [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT]: Use steady_clock for __clock_t if pthread_cond_clockwait is available. From-SVN: r275390
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| algorithm | Loading commit data... | |
| any | Loading commit data... | |
| array | Loading commit data... | |
| atomic | Loading commit data... | |
| bit | Loading commit data... | |
| bitset | Loading commit data... | |
| charconv | Loading commit data... | |
| chrono | Loading commit data... | |
| codecvt | Loading commit data... | |
| complex | Loading commit data... | |
| condition_variable | Loading commit data... | |
| deque | Loading commit data... | |
| execution | Loading commit data... | |
| filesystem | Loading commit data... | |
| forward_list | Loading commit data... | |
| fstream | Loading commit data... | |
| functional | Loading commit data... | |
| future | Loading commit data... | |
| iomanip | Loading commit data... | |
| ios | Loading commit data... | |
| iosfwd | Loading commit data... | |
| iostream | Loading commit data... | |
| istream | Loading commit data... | |
| iterator | Loading commit data... | |
| limits | Loading commit data... | |
| list | Loading commit data... | |
| locale | Loading commit data... | |
| map | Loading commit data... | |
| memory | Loading commit data... | |
| memory_resource | Loading commit data... | |
| mutex | Loading commit data... | |
| numbers | Loading commit data... | |
| numeric | Loading commit data... | |
| optional | Loading commit data... | |
| ostream | Loading commit data... | |
| queue | Loading commit data... | |
| random | Loading commit data... | |
| ratio | Loading commit data... | |
| regex | Loading commit data... | |
| scoped_allocator | Loading commit data... | |
| set | Loading commit data... | |
| shared_mutex | Loading commit data... | |
| sstream | Loading commit data... | |
| stack | Loading commit data... | |
| stdexcept | Loading commit data... | |
| streambuf | Loading commit data... | |
| string | Loading commit data... | |
| string_view | Loading commit data... | |
| system_error | Loading commit data... | |
| thread | Loading commit data... | |
| tuple | Loading commit data... | |
| type_traits | Loading commit data... | |
| typeindex | Loading commit data... | |
| unordered_map | Loading commit data... | |
| unordered_set | Loading commit data... | |
| utility | Loading commit data... | |
| valarray | Loading commit data... | |
| variant | Loading commit data... | |
| vector | Loading commit data... | |
| version | Loading commit data... |