diff --git a/include/boost/thread/detail/thread.hpp b/include/boost/thread/detail/thread.hpp index 340ff4ba..0e94ae9c 100644 --- a/include/boost/thread/detail/thread.hpp +++ b/include/boost/thread/detail/thread.hpp @@ -366,24 +366,25 @@ namespace boost bool timed_join(const system_time& abs_time); #ifdef BOOST_THREAD_USES_CHRONO - bool try_join_until(const chrono::time_point& tp) - { - if (this_thread::get_id() == get_id()) - { - boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); - } - detail::thread_data_ptr local_thread_info=(get_thread_info)(); - if(local_thread_info) - { - chrono::milliseconds rel_time= chrono::ceil(tp-chrono::system_clock::now()); - if(!this_thread::interruptible_wait(local_thread_info->thread_handle,rel_time.count())) - { - return false; - } - release_handle(); - } - return true; - } + bool try_join_until(const chrono::time_point& tp); +// bool try_join_until(const chrono::time_point& tp) +// { +// if (this_thread::get_id() == get_id()) +// { +// boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); +// } +// detail::thread_data_ptr local_thread_info=(get_thread_info)(); +// if(local_thread_info) +// { +// chrono::milliseconds rel_time= chrono::ceil(tp-chrono::system_clock::now()); +// if(!this_thread::interruptible_wait(local_thread_info->thread_handle,rel_time.count())) +// { +// return false; +// } +// release_handle(); +// } +// return true; +// } #endif public: diff --git a/src/win32/thread.cpp b/src/win32/thread.cpp index fccb149a..9b6670a6 100644 --- a/src/win32/thread.cpp +++ b/src/win32/thread.cpp @@ -334,6 +334,29 @@ namespace boost return true; } +#ifdef BOOST_THREAD_USES_CHRONO + + bool thread::try_join_until(const chrono::time_point& tp) + { + if (this_thread::get_id() == get_id()) + { + boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); + } + detail::thread_data_ptr local_thread_info=(get_thread_info)(); + if(local_thread_info) + { + chrono::milliseconds rel_time= chrono::ceil(tp-chrono::system_clock::now()); + if(!this_thread::interruptible_wait(local_thread_info->thread_handle,rel_time.count())) + { + return false; + } + release_handle(); + } + return true; + } + +#endif + void thread::detach() BOOST_NOEXCEPT { release_handle();