mirror of
https://github.com/boostorg/thread.git
synced 2026-02-08 23:22:13 +00:00
Cleanup
* Deleted a couple of unnecessary calls to internal_clock_t::now() in v2/thread.hpp. * Deleted the hidden::sleep_until() functions, which are no longer being used. * Deleted the condition_variable::do_wait_for() function, which is no longer being used. * Deleted the sleep_mutex and sleep_condition variables in pthread/thread_data.hpp, which are no longer being used.
This commit is contained in:
@@ -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<mutex> 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<mutex> 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user