本文整理汇总了C++中util::steady_duration类的典型用法代码示例。如果您正苦于以下问题:C++ steady_duration类的具体用法?C++ steady_duration怎么用?C++ steady_duration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了steady_duration类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: suspend
/// The function \a suspend will return control to the thread manager
/// (suspends the current thread). It sets the new state of this thread
/// to \a suspended and schedules a wakeup for this threads after the given
/// duration.
///
/// \note Must be called from within a HPX-thread.
///
/// \throws If <code>&ec != &throws</code>, never throws, but will set \a ec
/// to an appropriate value when an error occurs. Otherwise, this
/// function will throw an \a hpx#exception with an error code of
/// \a hpx#yield_aborted if it is signaled with \a wait_aborted.
/// If called outside of a HPX-thread, this function will throw
/// an \a hpx#exception with an error code of \a hpx::null_thread_id.
/// If this function is called while the thread-manager is not
/// running, it will throw an \a hpx#exception with an error code of
/// \a hpx#invalid_status.
///
inline threads::thread_state_ex_enum suspend(
util::steady_duration const& rel_time,
char const* description = "this_thread::suspend",
error_code& ec = throws)
{
return suspend(rel_time.from_now(), description, ec);
}
开发者ID:avyavkumar,项目名称:hpx,代码行数:24,代码来源:thread_helpers.hpp
示例2: set_thread_state_timed
thread_id_type set_thread_state_timed(SchedulingPolicy& scheduler,
util::steady_duration const& rel_time, thread_id_type const& thrd,
error_code& ec)
{
return set_thread_state_timed(scheduler, rel_time.from_now(), thrd,
pending, wait_timeout, thread_priority_normal, std::size_t(-1), ec);
}
开发者ID:akemp,项目名称:hpx,代码行数:7,代码来源:set_thread_state.hpp
示例3:
interval_timer::interval_timer(util::function_nonser<bool()> const& f,
util::function_nonser<void()> const& on_term,
util::steady_duration const& rel_time,
char const* description, bool pre_shutdown)
: timer_(std::make_shared<detail::interval_timer>(
f, on_term, rel_time.value().count() / 1000, description,
pre_shutdown))
{}
开发者ID:AALEKH,项目名称:hpx,代码行数:8,代码来源:interval_timer.cpp
示例4: set_thread_state
///////////////////////////////////////////////////////////////////////////
/// \brief Set the thread state of the \a thread referenced by the
/// thread_id \a id.
///
/// Set a timer to set the state of the given \a thread to the given
/// new value after it expired (after the given duration)
///
/// \param id [in] The thread id of the thread the state should
/// be modified for.
/// \param after_duration
/// \param state [in] The new state to be set for the thread
/// referenced by the \a id parameter.
/// \param state_ex [in] The new extended state to be set for the
/// thread referenced by the \a id parameter.
/// \param priority
/// \param ec [in,out] this represents the error status on exit,
/// if this is pre-initialized to \a hpx#throws
/// the function will throw on error instead.
///
/// \returns
///
/// \note As long as \a ec is not pre-initialized to
/// \a hpx#throws this function doesn't
/// throw but returns the result code using the
/// parameter \a ec. Otherwise it throws an instance
/// of hpx#exception.
inline thread_id_type set_thread_state(thread_id_type const& id,
util::steady_duration const& rel_time,
thread_state_enum state = pending,
thread_state_ex_enum stateex = wait_timeout,
thread_priority priority = thread_priority_normal,
error_code& ec = throws)
{
return set_thread_state(id, rel_time.from_now(), state, stateex,
priority, ec);
}
开发者ID:avyavkumar,项目名称:hpx,代码行数:36,代码来源:thread_helpers.hpp
示例5: start
bool pool_timer::start(util::steady_duration const& time_duration,
bool evaluate_)
{
std::unique_lock<mutex_type> l(mtx_);
if (is_terminated_)
return false;
if (!is_started_) {
if (first_start_) {
first_start_ = false;
util::unlock_guard<std::unique_lock<mutex_type> > ul(l);
if (pre_shutdown_)
{
register_pre_shutdown_function(
util::bind(&pool_timer::terminate,
this->shared_from_this()));
}
else
{
register_shutdown_function(
util::bind(&pool_timer::terminate,
this->shared_from_this()));
}
}
is_stopped_ = false;
is_started_ = true;
HPX_ASSERT(timer_ != nullptr);
timer_->expires_from_now(time_duration.value());
timer_->async_wait(util::bind(&pool_timer::timer_handler,
this->shared_from_this(), util::placeholders::_1));
return true;
}
return false;
}
开发者ID:brycelelbach,项目名称:hpx,代码行数:38,代码来源:pool_timer.cpp
示例6: try_lock_for
bool try_lock_for(util::steady_duration const& rel_time,
char const* description, error_code& ec = throws)
{
return try_lock_until(rel_time.from_now(), description, ec);
}
开发者ID:AntonBikineev,项目名称:hpx,代码行数:5,代码来源:mutex.hpp
示例7: wait_for
cv_status
wait_for(Lock& lock, util::steady_duration const& rel_time,
error_code& ec = throws)
{
return wait_until(lock, rel_time.from_now(), ec);
}
开发者ID:HadrienG2,项目名称:hpx,代码行数:6,代码来源:condition_variable.hpp
示例8: speed_up
void interval_timer::speed_up(util::steady_duration const& min_interval)
{
return timer_->speed_up(min_interval.value().count() / 1000);
}
开发者ID:AALEKH,项目名称:hpx,代码行数:4,代码来源:interval_timer.cpp
示例9: slow_down
void interval_timer::slow_down(util::steady_duration const& max_interval)
{
return timer_->slow_down(max_interval.value().count() / 1000);
}
开发者ID:AALEKH,项目名称:hpx,代码行数:4,代码来源:interval_timer.cpp
注:本文中的util::steady_duration类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论