summaryrefslogtreecommitdiff
path: root/boost/thread/detail
diff options
context:
space:
mode:
Diffstat (limited to 'boost/thread/detail')
-rw-r--r--boost/thread/detail/config.hpp2
-rw-r--r--boost/thread/detail/thread.hpp15
2 files changed, 13 insertions, 4 deletions
diff --git a/boost/thread/detail/config.hpp b/boost/thread/detail/config.hpp
index b060b81c95..6d1595ebc7 100644
--- a/boost/thread/detail/config.hpp
+++ b/boost/thread/detail/config.hpp
@@ -12,6 +12,8 @@
#include <boost/detail/workaround.hpp>
#include <boost/thread/detail/platform.hpp>
+//#define BOOST_THREAD_USEFIXES_TIMESPEC
+//#define BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC
//#define BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
// ATTRIBUTE_MAY_ALIAS
diff --git a/boost/thread/detail/thread.hpp b/boost/thread/detail/thread.hpp
index 9e7e8b8f5e..bd2f149a0e 100644
--- a/boost/thread/detail/thread.hpp
+++ b/boost/thread/detail/thread.hpp
@@ -482,13 +482,20 @@ namespace boost
return try_join_until(chrono::steady_clock::now() + rel_time);
}
#endif
+
+#if defined(BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC) && defined(BOOST_THREAD_USEFIXES_TIMESPEC)
+ typedef chrono::steady_clock my_clock_t;
+#else
+ typedef chrono::system_clock my_clock_t;
+#endif
+
template <class Clock, class Duration>
bool try_join_until(const chrono::time_point<Clock, Duration>& t)
{
using namespace chrono;
bool joined= false;
do {
- system_clock::time_point s_now = system_clock::now();
+ my_clock_t::time_point s_now = my_clock_t::now();
typename Clock::duration d = ceil<nanoseconds>(t-Clock::now());
if (d <= Clock::duration::zero()) return false; // in case the Clock::time_point t is already reached
joined = try_join_until(s_now + d);
@@ -496,10 +503,10 @@ namespace boost
return true;
}
template <class Duration>
- bool try_join_until(const chrono::time_point<chrono::system_clock, Duration>& t)
+ bool try_join_until(const chrono::time_point<my_clock_t, Duration>& t)
{
using namespace chrono;
- typedef time_point<system_clock, nanoseconds> nano_sys_tmpt;
+ typedef time_point<my_clock_t, nanoseconds> nano_sys_tmpt;
return try_join_until(nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch())));
}
#endif
@@ -514,7 +521,7 @@ namespace boost
//}
#ifdef BOOST_THREAD_USES_CHRONO
- bool try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp)
+ bool try_join_until(const chrono::time_point<my_clock_t, chrono::nanoseconds>& tp)
{
chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now());
return do_try_join_until(rel_time.count());