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.hpp26
2 files changed, 15 insertions, 13 deletions
diff --git a/boost/thread/detail/config.hpp b/boost/thread/detail/config.hpp
index 6d1595ebc7..9eff05f5be 100644
--- a/boost/thread/detail/config.hpp
+++ b/boost/thread/detail/config.hpp
@@ -12,7 +12,7 @@
#include <boost/detail/workaround.hpp>
#include <boost/thread/detail/platform.hpp>
-//#define BOOST_THREAD_USEFIXES_TIMESPEC
+#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 bd2f149a0e..6424e48385 100644
--- a/boost/thread/detail/thread.hpp
+++ b/boost/thread/detail/thread.hpp
@@ -155,7 +155,15 @@ namespace boost
};
#endif
}
-
+namespace thread_detail {
+#ifdef BOOST_THREAD_USES_CHRONO
+#if defined(BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC) && defined(BOOST_THREAD_USEFIXES_TIMESPEC)
+ typedef chrono::steady_clock internal_clock_t;
+#else
+ typedef chrono::system_clock internal_clock_t;
+#endif
+#endif
+}
class BOOST_THREAD_DECL thread
{
public:
@@ -483,19 +491,13 @@ namespace boost
}
#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 {
- my_clock_t::time_point s_now = my_clock_t::now();
+ thread_detail::internal_clock_t::time_point s_now = thread_detail::internal_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);
@@ -503,10 +505,10 @@ namespace boost
return true;
}
template <class Duration>
- bool try_join_until(const chrono::time_point<my_clock_t, Duration>& t)
+ bool try_join_until(const chrono::time_point<thread_detail::internal_clock_t, Duration>& t)
{
using namespace chrono;
- typedef time_point<my_clock_t, nanoseconds> nano_sys_tmpt;
+ typedef time_point<thread_detail::internal_clock_t, nanoseconds> nano_sys_tmpt;
return try_join_until(nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch())));
}
#endif
@@ -521,7 +523,7 @@ namespace boost
//}
#ifdef BOOST_THREAD_USES_CHRONO
- bool try_join_until(const chrono::time_point<my_clock_t, chrono::nanoseconds>& tp)
+ bool try_join_until(const chrono::time_point<thread_detail::internal_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());
@@ -542,7 +544,7 @@ namespace boost
}
#endif
#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<thread_detail::internal_clock_t, chrono::nanoseconds>& tp)
{
using namespace chrono;
nanoseconds d = tp.time_since_epoch();