diff --git a/include/boost/thread/pthread/condition_variable_fwd.hpp b/include/boost/thread/pthread/condition_variable_fwd.hpp index 38a425c7..4b93c375 100644 --- a/include/boost/thread/pthread/condition_variable_fwd.hpp +++ b/include/boost/thread/pthread/condition_variable_fwd.hpp @@ -61,12 +61,6 @@ namespace boost } return true; } - bool do_wait_for( - unique_lock& lock, - detail::timespec_duration const &timeout) - { - return do_wait_until(lock, timeout + detail::internal_timespec_clock::now()); - } public: BOOST_THREAD_NO_COPYABLE(condition_variable) diff --git a/include/boost/thread/pthread/thread_data.hpp b/include/boost/thread/pthread/thread_data.hpp index 27327559..bde260a1 100644 --- a/include/boost/thread/pthread/thread_data.hpp +++ b/include/boost/thread/pthread/thread_data.hpp @@ -111,8 +111,6 @@ namespace boost pthread_t thread_handle; boost::mutex data_mutex; boost::condition_variable done_condition; - boost::mutex sleep_mutex; - boost::condition_variable sleep_condition; bool done; bool join_started; bool joined; @@ -244,7 +242,6 @@ namespace boost namespace hidden { void BOOST_THREAD_DECL sleep_for(const detail::timespec_duration& ts); - void BOOST_THREAD_DECL sleep_until(const detail::internal_timespec_timepoint& ts); } #ifdef BOOST_THREAD_USES_CHRONO @@ -265,7 +262,6 @@ namespace boost namespace hidden { void BOOST_THREAD_DECL sleep_for(const detail::timespec_duration& ts); - void BOOST_THREAD_DECL sleep_until(const detail::internal_timespec_timepoint& ts); } #ifdef BOOST_THREAD_USES_CHRONO @@ -292,9 +288,6 @@ namespace boost #endif inline void sleep(system_time const& abs_time) { -#if 0 - boost::this_thread::hidden::sleep_until(detail::internal_timespec_timepoint(abs_time)); -#else const detail::real_timespec_timepoint ts(abs_time); mutex mx; unique_lock lock(mx); @@ -313,7 +306,6 @@ namespace boost } #else while (cond.do_wait_until(lock, ts)) {} -#endif #endif } diff --git a/include/boost/thread/v2/thread.hpp b/include/boost/thread/v2/thread.hpp index a5c4f88d..4ccca7de 100644 --- a/include/boost/thread/v2/thread.hpp +++ b/include/boost/thread/v2/thread.hpp @@ -87,10 +87,7 @@ namespace boost mutex mut; condition_variable cv; unique_lock lk(mut); - while (thread_detail::internal_clock_t::now() < t) - { - cv.wait_until(lk, t); - } + while (cv_status::no_timeout == cv.wait_until(lk, t)) {} } template @@ -119,10 +116,7 @@ namespace boost mutex mut; condition_variable cv; unique_lock lk(mut); - while (thread_detail::internal_clock_t::now() < t) - { - cv.wait_until(lk, t); - } + while (cv_status::no_timeout == cv.wait_until(lk, t)) {} } template diff --git a/src/pthread/thread.cpp b/src/pthread/thread.cpp index 4df4a915..60cdb4fb 100644 --- a/src/pthread/thread.cpp +++ b/src/pthread/thread.cpp @@ -457,34 +457,6 @@ namespace boost # endif } } - - void BOOST_THREAD_DECL sleep_until(const detail::internal_timespec_timepoint& ts) - { - detail::internal_timespec_timepoint now = detail::internal_timespec_clock::now(); - if (ts > now) - { - for (int foo=0; foo < 5; ++foo) - { - # if defined(BOOST_HAS_PTHREAD_DELAY_NP) - detail::timespec_duration d = ts - now; - BOOST_VERIFY(!pthread_delay_np(&d.get())); - # elif defined(BOOST_HAS_NANOSLEEP) - detail::timespec_duration d = ts - now; - nanosleep(&d.get(), 0); - # else - mutex mx; - unique_lock lock(mx); - condition_variable cond; - cond.do_wait_until(lock, ts); - # endif - detail::internal_timespec_timepoint now2 = detail::internal_timespec_clock::now(); - if (now2 >= ts) - { - return; - } - } - } - } } } namespace hidden @@ -512,21 +484,6 @@ namespace boost while (cond.do_wait_until(lock, ts2)) {} #endif } - - void BOOST_THREAD_DECL sleep_until(const detail::internal_timespec_timepoint& ts) - { - boost::detail::thread_data_base* const thread_info=boost::detail::get_current_thread_data(); - - if(thread_info) - { - unique_lock lk(thread_info->sleep_mutex); - while(thread_info->sleep_condition.do_wait_until(lk,ts)) {} - } - else - { - boost::this_thread::no_interruption_point::hidden::sleep_until(ts); - } - } } // hidden } // this_thread