update boost on linux
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// basic_waitable_timer.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -17,18 +17,36 @@
|
||||
|
||||
#include <boost/asio/detail/config.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/asio/basic_io_object.hpp>
|
||||
#include <boost/asio/detail/chrono_time_traits.hpp>
|
||||
#include <boost/asio/detail/deadline_timer_service.hpp>
|
||||
#include <boost/asio/detail/handler_type_requirements.hpp>
|
||||
#include <boost/asio/detail/io_object_impl.hpp>
|
||||
#include <boost/asio/detail/non_const_lvalue.hpp>
|
||||
#include <boost/asio/detail/throw_error.hpp>
|
||||
#include <boost/asio/error.hpp>
|
||||
#include <boost/asio/executor.hpp>
|
||||
#include <boost/asio/wait_traits.hpp>
|
||||
#include <boost/asio/waitable_timer_service.hpp>
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_MOVE)
|
||||
# include <utility>
|
||||
#endif // defined(BOOST_ASIO_HAS_MOVE)
|
||||
|
||||
#include <boost/asio/detail/push_options.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace asio {
|
||||
|
||||
#if !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL)
|
||||
#define BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL
|
||||
|
||||
// Forward declaration with defaulted arguments.
|
||||
template <typename Clock,
|
||||
typename WaitTraits = boost::asio::wait_traits<Clock>,
|
||||
typename Executor = executor>
|
||||
class basic_waitable_timer;
|
||||
|
||||
#endif // !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL)
|
||||
|
||||
/// Provides waitable timer functionality.
|
||||
/**
|
||||
* The basic_waitable_timer class template provides the ability to perform a
|
||||
@@ -52,10 +70,10 @@ namespace asio {
|
||||
* Performing a blocking wait (C++11):
|
||||
* @code
|
||||
* // Construct a timer without setting an expiry time.
|
||||
* boost::asio::steady_timer timer(io_service);
|
||||
* boost::asio::steady_timer timer(my_context);
|
||||
*
|
||||
* // Set an expiry time relative to now.
|
||||
* timer.expires_from_now(std::chrono::seconds(5));
|
||||
* timer.expires_after(std::chrono::seconds(5));
|
||||
*
|
||||
* // Wait for the timer to expire.
|
||||
* timer.wait();
|
||||
@@ -75,7 +93,7 @@ namespace asio {
|
||||
* ...
|
||||
*
|
||||
* // Construct a timer with an absolute expiry time.
|
||||
* boost::asio::steady_timer timer(io_service,
|
||||
* boost::asio::steady_timer timer(my_context,
|
||||
* std::chrono::steady_clock::now() + std::chrono::seconds(60));
|
||||
*
|
||||
* // Start an asynchronous wait.
|
||||
@@ -92,7 +110,7 @@ namespace asio {
|
||||
* @code
|
||||
* void on_some_event()
|
||||
* {
|
||||
* if (my_timer.expires_from_now(seconds(5)) > 0)
|
||||
* if (my_timer.expires_after(seconds(5)) > 0)
|
||||
* {
|
||||
* // We managed to cancel the timer. Start new asynchronous wait.
|
||||
* my_timer.async_wait(on_timeout);
|
||||
@@ -112,7 +130,7 @@ namespace asio {
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* @li The boost::asio::basic_waitable_timer::expires_from_now() function
|
||||
* @li The boost::asio::basic_waitable_timer::expires_after() function
|
||||
* cancels any pending asynchronous waits, and returns the number of
|
||||
* asynchronous waits that were cancelled. If it returns 0 then you were too
|
||||
* late and the wait handler has already been executed, or will soon be
|
||||
@@ -121,13 +139,13 @@ namespace asio {
|
||||
* @li If a wait handler is cancelled, the boost::system::error_code passed to
|
||||
* it contains the value boost::asio::error::operation_aborted.
|
||||
*/
|
||||
template <typename Clock,
|
||||
typename WaitTraits = boost::asio::wait_traits<Clock>,
|
||||
typename WaitableTimerService = waitable_timer_service<Clock, WaitTraits> >
|
||||
template <typename Clock, typename WaitTraits, typename Executor>
|
||||
class basic_waitable_timer
|
||||
: public basic_io_object<WaitableTimerService>
|
||||
{
|
||||
public:
|
||||
/// The type of the executor associated with the object.
|
||||
typedef Executor executor_type;
|
||||
|
||||
/// The clock type.
|
||||
typedef Clock clock_type;
|
||||
|
||||
@@ -143,14 +161,33 @@ public:
|
||||
/// Constructor.
|
||||
/**
|
||||
* This constructor creates a timer without setting an expiry time. The
|
||||
* expires_at() or expires_from_now() functions must be called to set an
|
||||
* expiry time before the timer can be waited on.
|
||||
* expires_at() or expires_after() functions must be called to set an expiry
|
||||
* time before the timer can be waited on.
|
||||
*
|
||||
* @param io_service The io_service object that the timer will use to dispatch
|
||||
* handlers for any asynchronous operations performed on the timer.
|
||||
* @param ex The I/O executor that the timer will use, by default, to
|
||||
* dispatch handlers for any asynchronous operations performed on the timer.
|
||||
*/
|
||||
explicit basic_waitable_timer(boost::asio::io_service& io_service)
|
||||
: basic_io_object<WaitableTimerService>(io_service)
|
||||
explicit basic_waitable_timer(const executor_type& ex)
|
||||
: impl_(ex)
|
||||
{
|
||||
}
|
||||
|
||||
/// Constructor.
|
||||
/**
|
||||
* This constructor creates a timer without setting an expiry time. The
|
||||
* expires_at() or expires_after() functions must be called to set an expiry
|
||||
* time before the timer can be waited on.
|
||||
*
|
||||
* @param context An execution context which provides the I/O executor that
|
||||
* the timer will use, by default, to dispatch handlers for any asynchronous
|
||||
* operations performed on the timer.
|
||||
*/
|
||||
template <typename ExecutionContext>
|
||||
explicit basic_waitable_timer(ExecutionContext& context,
|
||||
typename enable_if<
|
||||
is_convertible<ExecutionContext&, execution_context&>::value
|
||||
>::type* = 0)
|
||||
: impl_(context)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -158,18 +195,41 @@ public:
|
||||
/**
|
||||
* This constructor creates a timer and sets the expiry time.
|
||||
*
|
||||
* @param io_service The io_service object that the timer will use to dispatch
|
||||
* handlers for any asynchronous operations performed on the timer.
|
||||
* @param ex The I/O executor object that the timer will use, by default, to
|
||||
* dispatch handlers for any asynchronous operations performed on the timer.
|
||||
*
|
||||
* @param expiry_time The expiry time to be used for the timer, expressed
|
||||
* as an absolute time.
|
||||
*/
|
||||
basic_waitable_timer(boost::asio::io_service& io_service,
|
||||
const time_point& expiry_time)
|
||||
: basic_io_object<WaitableTimerService>(io_service)
|
||||
basic_waitable_timer(const executor_type& ex, const time_point& expiry_time)
|
||||
: impl_(ex)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
this->service.expires_at(this->implementation, expiry_time, ec);
|
||||
impl_.get_service().expires_at(impl_.get_implementation(), expiry_time, ec);
|
||||
boost::asio::detail::throw_error(ec, "expires_at");
|
||||
}
|
||||
|
||||
/// Constructor to set a particular expiry time as an absolute time.
|
||||
/**
|
||||
* This constructor creates a timer and sets the expiry time.
|
||||
*
|
||||
* @param context An execution context which provides the I/O executor that
|
||||
* the timer will use, by default, to dispatch handlers for any asynchronous
|
||||
* operations performed on the timer.
|
||||
*
|
||||
* @param expiry_time The expiry time to be used for the timer, expressed
|
||||
* as an absolute time.
|
||||
*/
|
||||
template <typename ExecutionContext>
|
||||
explicit basic_waitable_timer(ExecutionContext& context,
|
||||
const time_point& expiry_time,
|
||||
typename enable_if<
|
||||
is_convertible<ExecutionContext&, execution_context&>::value
|
||||
>::type* = 0)
|
||||
: impl_(context)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
impl_.get_service().expires_at(impl_.get_implementation(), expiry_time, ec);
|
||||
boost::asio::detail::throw_error(ec, "expires_at");
|
||||
}
|
||||
|
||||
@@ -177,19 +237,95 @@ public:
|
||||
/**
|
||||
* This constructor creates a timer and sets the expiry time.
|
||||
*
|
||||
* @param io_service The io_service object that the timer will use to dispatch
|
||||
* handlers for any asynchronous operations performed on the timer.
|
||||
* @param ex The I/O executor that the timer will use, by default, to
|
||||
* dispatch handlers for any asynchronous operations performed on the timer.
|
||||
*
|
||||
* @param expiry_time The expiry time to be used for the timer, relative to
|
||||
* now.
|
||||
*/
|
||||
basic_waitable_timer(boost::asio::io_service& io_service,
|
||||
const duration& expiry_time)
|
||||
: basic_io_object<WaitableTimerService>(io_service)
|
||||
basic_waitable_timer(const executor_type& ex, const duration& expiry_time)
|
||||
: impl_(ex)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
this->service.expires_from_now(this->implementation, expiry_time, ec);
|
||||
boost::asio::detail::throw_error(ec, "expires_from_now");
|
||||
impl_.get_service().expires_after(
|
||||
impl_.get_implementation(), expiry_time, ec);
|
||||
boost::asio::detail::throw_error(ec, "expires_after");
|
||||
}
|
||||
|
||||
/// Constructor to set a particular expiry time relative to now.
|
||||
/**
|
||||
* This constructor creates a timer and sets the expiry time.
|
||||
*
|
||||
* @param context An execution context which provides the I/O executor that
|
||||
* the timer will use, by default, to dispatch handlers for any asynchronous
|
||||
* operations performed on the timer.
|
||||
*
|
||||
* @param expiry_time The expiry time to be used for the timer, relative to
|
||||
* now.
|
||||
*/
|
||||
template <typename ExecutionContext>
|
||||
explicit basic_waitable_timer(ExecutionContext& context,
|
||||
const duration& expiry_time,
|
||||
typename enable_if<
|
||||
is_convertible<ExecutionContext&, execution_context&>::value
|
||||
>::type* = 0)
|
||||
: impl_(context)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
impl_.get_service().expires_after(
|
||||
impl_.get_implementation(), expiry_time, ec);
|
||||
boost::asio::detail::throw_error(ec, "expires_after");
|
||||
}
|
||||
|
||||
#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
/// Move-construct a basic_waitable_timer from another.
|
||||
/**
|
||||
* This constructor moves a timer from one object to another.
|
||||
*
|
||||
* @param other The other basic_waitable_timer object from which the move will
|
||||
* occur.
|
||||
*
|
||||
* @note Following the move, the moved-from object is in the same state as if
|
||||
* constructed using the @c basic_waitable_timer(const executor_type&)
|
||||
* constructor.
|
||||
*/
|
||||
basic_waitable_timer(basic_waitable_timer&& other)
|
||||
: impl_(std::move(other.impl_))
|
||||
{
|
||||
}
|
||||
|
||||
/// Move-assign a basic_waitable_timer from another.
|
||||
/**
|
||||
* This assignment operator moves a timer from one object to another. Cancels
|
||||
* any outstanding asynchronous operations associated with the target object.
|
||||
*
|
||||
* @param other The other basic_waitable_timer object from which the move will
|
||||
* occur.
|
||||
*
|
||||
* @note Following the move, the moved-from object is in the same state as if
|
||||
* constructed using the @c basic_waitable_timer(const executor_type&)
|
||||
* constructor.
|
||||
*/
|
||||
basic_waitable_timer& operator=(basic_waitable_timer&& other)
|
||||
{
|
||||
impl_ = std::move(other.impl_);
|
||||
return *this;
|
||||
}
|
||||
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Destroys the timer.
|
||||
/**
|
||||
* This function destroys the timer, cancelling any outstanding asynchronous
|
||||
* wait operations associated with the timer as if by calling @c cancel.
|
||||
*/
|
||||
~basic_waitable_timer()
|
||||
{
|
||||
}
|
||||
|
||||
/// Get the executor associated with the object.
|
||||
executor_type get_executor() BOOST_ASIO_NOEXCEPT
|
||||
{
|
||||
return impl_.get_executor();
|
||||
}
|
||||
|
||||
/// Cancel any asynchronous operations that are waiting on the timer.
|
||||
@@ -217,12 +353,14 @@ public:
|
||||
std::size_t cancel()
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
std::size_t s = this->service.cancel(this->implementation, ec);
|
||||
std::size_t s = impl_.get_service().cancel(impl_.get_implementation(), ec);
|
||||
boost::asio::detail::throw_error(ec, "cancel");
|
||||
return s;
|
||||
}
|
||||
|
||||
/// Cancel any asynchronous operations that are waiting on the timer.
|
||||
#if !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
/// (Deprecated: Use non-error_code overload.) Cancel any asynchronous
|
||||
/// operations that are waiting on the timer.
|
||||
/**
|
||||
* This function forces the completion of any pending asynchronous wait
|
||||
* operations against the timer. The handler for each cancelled operation will
|
||||
@@ -246,8 +384,9 @@ public:
|
||||
*/
|
||||
std::size_t cancel(boost::system::error_code& ec)
|
||||
{
|
||||
return this->service.cancel(this->implementation, ec);
|
||||
return impl_.get_service().cancel(impl_.get_implementation(), ec);
|
||||
}
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
/// Cancels one asynchronous operation that is waiting on the timer.
|
||||
/**
|
||||
@@ -276,12 +415,15 @@ public:
|
||||
std::size_t cancel_one()
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
std::size_t s = this->service.cancel_one(this->implementation, ec);
|
||||
std::size_t s = impl_.get_service().cancel_one(
|
||||
impl_.get_implementation(), ec);
|
||||
boost::asio::detail::throw_error(ec, "cancel_one");
|
||||
return s;
|
||||
}
|
||||
|
||||
/// Cancels one asynchronous operation that is waiting on the timer.
|
||||
#if !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
/// (Deprecated: Use non-error_code overload.) Cancels one asynchronous
|
||||
/// operation that is waiting on the timer.
|
||||
/**
|
||||
* This function forces the completion of one pending asynchronous wait
|
||||
* operation against the timer. Handlers are cancelled in FIFO order. The
|
||||
@@ -307,17 +449,29 @@ public:
|
||||
*/
|
||||
std::size_t cancel_one(boost::system::error_code& ec)
|
||||
{
|
||||
return this->service.cancel_one(this->implementation, ec);
|
||||
return impl_.get_service().cancel_one(impl_.get_implementation(), ec);
|
||||
}
|
||||
|
||||
/// Get the timer's expiry time as an absolute time.
|
||||
/// (Deprecated: Use expiry().) Get the timer's expiry time as an absolute
|
||||
/// time.
|
||||
/**
|
||||
* This function may be used to obtain the timer's current expiry time.
|
||||
* Whether the timer has expired or not does not affect this value.
|
||||
*/
|
||||
time_point expires_at() const
|
||||
{
|
||||
return this->service.expires_at(this->implementation);
|
||||
return impl_.get_service().expires_at(impl_.get_implementation());
|
||||
}
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
/// Get the timer's expiry time as an absolute time.
|
||||
/**
|
||||
* This function may be used to obtain the timer's current expiry time.
|
||||
* Whether the timer has expired or not does not affect this value.
|
||||
*/
|
||||
time_point expiry() const
|
||||
{
|
||||
return impl_.get_service().expiry(impl_.get_implementation());
|
||||
}
|
||||
|
||||
/// Set the timer's expiry time as an absolute time.
|
||||
@@ -345,13 +499,15 @@ public:
|
||||
std::size_t expires_at(const time_point& expiry_time)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
std::size_t s = this->service.expires_at(
|
||||
this->implementation, expiry_time, ec);
|
||||
std::size_t s = impl_.get_service().expires_at(
|
||||
impl_.get_implementation(), expiry_time, ec);
|
||||
boost::asio::detail::throw_error(ec, "expires_at");
|
||||
return s;
|
||||
}
|
||||
|
||||
/// Set the timer's expiry time as an absolute time.
|
||||
#if !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
/// (Deprecated: Use non-error_code overload.) Set the timer's expiry time as
|
||||
/// an absolute time.
|
||||
/**
|
||||
* This function sets the expiry time. Any pending asynchronous wait
|
||||
* operations will be cancelled. The handler for each cancelled operation will
|
||||
@@ -376,20 +532,55 @@ public:
|
||||
std::size_t expires_at(const time_point& expiry_time,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
return this->service.expires_at(this->implementation, expiry_time, ec);
|
||||
return impl_.get_service().expires_at(
|
||||
impl_.get_implementation(), expiry_time, ec);
|
||||
}
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
/// Set the timer's expiry time relative to now.
|
||||
/**
|
||||
* This function sets the expiry time. Any pending asynchronous wait
|
||||
* operations will be cancelled. The handler for each cancelled operation will
|
||||
* be invoked with the boost::asio::error::operation_aborted error code.
|
||||
*
|
||||
* @param expiry_time The expiry time to be used for the timer.
|
||||
*
|
||||
* @return The number of asynchronous operations that were cancelled.
|
||||
*
|
||||
* @throws boost::system::system_error Thrown on failure.
|
||||
*
|
||||
* @note If the timer has already expired when expires_after() is called,
|
||||
* then the handlers for asynchronous wait operations will:
|
||||
*
|
||||
* @li have already been invoked; or
|
||||
*
|
||||
* @li have been queued for invocation in the near future.
|
||||
*
|
||||
* These handlers can no longer be cancelled, and therefore are passed an
|
||||
* error code that indicates the successful completion of the wait operation.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/// Get the timer's expiry time relative to now.
|
||||
#if !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
/// (Deprecated: Use expiry().) Get the timer's expiry time relative to now.
|
||||
/**
|
||||
* This function may be used to obtain the timer's current expiry time.
|
||||
* Whether the timer has expired or not does not affect this value.
|
||||
*/
|
||||
duration expires_from_now() const
|
||||
{
|
||||
return this->service.expires_from_now(this->implementation);
|
||||
return impl_.get_service().expires_from_now(impl_.get_implementation());
|
||||
}
|
||||
|
||||
/// Set the timer's expiry time relative to now.
|
||||
/// (Deprecated: Use expires_after().) Set the timer's expiry time relative
|
||||
/// to now.
|
||||
/**
|
||||
* This function sets the expiry time. Any pending asynchronous wait
|
||||
* operations will be cancelled. The handler for each cancelled operation will
|
||||
@@ -414,13 +605,14 @@ public:
|
||||
std::size_t expires_from_now(const duration& expiry_time)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
std::size_t s = this->service.expires_from_now(
|
||||
this->implementation, expiry_time, ec);
|
||||
std::size_t s = impl_.get_service().expires_from_now(
|
||||
impl_.get_implementation(), expiry_time, ec);
|
||||
boost::asio::detail::throw_error(ec, "expires_from_now");
|
||||
return s;
|
||||
}
|
||||
|
||||
/// Set the timer's expiry time relative to now.
|
||||
/// (Deprecated: Use expires_after().) Set the timer's expiry time relative
|
||||
/// to now.
|
||||
/**
|
||||
* This function sets the expiry time. Any pending asynchronous wait
|
||||
* operations will be cancelled. The handler for each cancelled operation will
|
||||
@@ -445,9 +637,10 @@ public:
|
||||
std::size_t expires_from_now(const duration& expiry_time,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
return this->service.expires_from_now(
|
||||
this->implementation, expiry_time, ec);
|
||||
return impl_.get_service().expires_from_now(
|
||||
impl_.get_implementation(), expiry_time, ec);
|
||||
}
|
||||
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
|
||||
|
||||
/// Perform a blocking wait on the timer.
|
||||
/**
|
||||
@@ -459,7 +652,7 @@ public:
|
||||
void wait()
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
this->service.wait(this->implementation, ec);
|
||||
impl_.get_service().wait(impl_.get_implementation(), ec);
|
||||
boost::asio::detail::throw_error(ec, "wait");
|
||||
}
|
||||
|
||||
@@ -472,7 +665,7 @@ public:
|
||||
*/
|
||||
void wait(boost::system::error_code& ec)
|
||||
{
|
||||
this->service.wait(this->implementation, ec);
|
||||
impl_.get_service().wait(impl_.get_implementation(), ec);
|
||||
}
|
||||
|
||||
/// Start an asynchronous wait on the timer.
|
||||
@@ -495,22 +688,46 @@ public:
|
||||
* const boost::system::error_code& error // Result of operation.
|
||||
* ); @endcode
|
||||
* Regardless of whether the asynchronous operation completes immediately or
|
||||
* not, the handler will not be invoked from within this function. Invocation
|
||||
* of the handler will be performed in a manner equivalent to using
|
||||
* boost::asio::io_service::post().
|
||||
* not, the handler will not be invoked from within this function. On
|
||||
* immediate completion, invocation of the handler will be performed in a
|
||||
* manner equivalent to using boost::asio::post().
|
||||
*/
|
||||
template <typename WaitHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler,
|
||||
void (boost::system::error_code))
|
||||
async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
|
||||
{
|
||||
// If you get an error on the following line it means that your handler does
|
||||
// not meet the documented type requirements for a WaitHandler.
|
||||
BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
|
||||
|
||||
return this->service.async_wait(this->implementation,
|
||||
BOOST_ASIO_MOVE_CAST(WaitHandler)(handler));
|
||||
return async_initiate<WaitHandler, void (boost::system::error_code)>(
|
||||
initiate_async_wait(), handler, this);
|
||||
}
|
||||
|
||||
private:
|
||||
// Disallow copying and assignment.
|
||||
basic_waitable_timer(const basic_waitable_timer&) BOOST_ASIO_DELETED;
|
||||
basic_waitable_timer& operator=(
|
||||
const basic_waitable_timer&) BOOST_ASIO_DELETED;
|
||||
|
||||
struct initiate_async_wait
|
||||
{
|
||||
template <typename WaitHandler>
|
||||
void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler,
|
||||
basic_waitable_timer* self) const
|
||||
{
|
||||
// If you get an error on the following line it means that your handler
|
||||
// does not meet the documented type requirements for a WaitHandler.
|
||||
BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
|
||||
|
||||
detail::non_const_lvalue<WaitHandler> handler2(handler);
|
||||
self->impl_.get_service().async_wait(
|
||||
self->impl_.get_implementation(), handler2.value,
|
||||
self->impl_.get_implementation_executor());
|
||||
}
|
||||
};
|
||||
|
||||
detail::io_object_impl<
|
||||
detail::deadline_timer_service<
|
||||
detail::chrono_time_traits<Clock, WaitTraits> >,
|
||||
executor_type > impl_;
|
||||
};
|
||||
|
||||
} // namespace asio
|
||||
|
||||
Reference in New Issue
Block a user