Boost Asio总结(10)定时器
Posted thefist11
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Boost Asio总结(10)定时器相关的知识,希望对你有一定的参考价值。
template <typename Clock, typename WaitTraits, typename Executor>
class basic_waitable_timer
public:
/// The type of the executor associated with the object.
typedef Executor executor_type;
/// The clock type.
typedef Clock clock_type;
/// The duration type of the clock.
typedef typename clock_type::duration duration;
/// The time point type of the clock.
typedef typename clock_type::time_point time_point;
std::size_t cancel()
boost::system::error_code ec;
std::size_t s = impl_.get_service().cancel(impl_.get_implementation(), ec);
boost::asio::detail::throw_error(ec, "cancel");
return s;
time_point expires_at() const
return impl_.get_service().expires_at(impl_.get_implementation());
time_point expiry() const
return impl_.get_service().expiry(impl_.get_implementation());
std::size_t expires_after(const duration& expiry_time)
boost::system::error_code ec;
std::size_t s = impl_.get_service().expires_after(
impl_.get_implementation(), expiry_time, ec);
boost::asio::detail::throw_error(ec, "expires_after");
return s;
void wait()
boost::system::error_code ec;
impl_.get_service().wait(impl_.get_implementation(), ec);
boost::asio::detail::throw_error(ec, "wait");
template <typename WaitHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler,
void (boost::system::error_code))
async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
return async_initiate<WaitHandler, void (boost::system::error_code)>(
initiate_async_wait(), handler, this);
以上是关于Boost Asio总结(10)定时器的主要内容,如果未能解决你的问题,请参考以下文章