Index: boost/thread/detail/thread.hpp =================================================================== --- boost/thread/detail/thread.hpp (revision 80189) +++ boost/thread/detail/thread.hpp (working copy) @@ -364,30 +364,18 @@ #endif #if defined(BOOST_THREAD_PLATFORM_WIN32) bool timed_join(const system_time& abs_time); - + private: + bool do_try_join_until(uintmax_t milli); + public: #ifdef BOOST_THREAD_USES_CHRONO - 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; -// } + bool try_join_until(const chrono::time_point& tp) + { + chrono::milliseconds rel_time= chrono::ceil(tp-chrono::system_clock::now()); + return do_try_join_until(rel_time.count()); + } #endif - public: + #else bool timed_join(const system_time& abs_time) { Index: libs/thread/src/win32/thread.cpp =================================================================== --- libs/thread/src/win32/thread.cpp (revision 80189) +++ libs/thread/src/win32/thread.cpp (working copy) @@ -318,45 +318,27 @@ bool thread::timed_join(boost::system_time const& wait_until) { - 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) - { - if(!this_thread::interruptible_wait(local_thread_info->thread_handle,get_milliseconds_until(wait_until))) - { - return false; - } - release_handle(); - } - return true; + return do_try_join_until(get_milliseconds_until(wait_until)); } -#ifdef BOOST_THREAD_USES_CHRONO - - bool thread::try_join_until(const chrono::time_point& tp) + bool thread::do_try_join_until(uintmax_t milli) { if (this_thread::get_id() == get_id()) { - boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); + 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(); + if(!this_thread::interruptible_wait(local_thread_info->thread_handle,milli)) + { + return false; + } + release_handle(); } return true; } -#endif - void thread::detach() BOOST_NOEXCEPT { release_handle();