basic_waitable_timer.hpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. //
  2. // basic_waitable_timer.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2025 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP
  11. #define BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <cstddef>
  17. #include <utility>
  18. #include <boost/asio/any_io_executor.hpp>
  19. #include <boost/asio/detail/chrono_time_traits.hpp>
  20. #include <boost/asio/detail/deadline_timer_service.hpp>
  21. #include <boost/asio/detail/handler_type_requirements.hpp>
  22. #include <boost/asio/detail/io_object_impl.hpp>
  23. #include <boost/asio/detail/non_const_lvalue.hpp>
  24. #include <boost/asio/detail/throw_error.hpp>
  25. #include <boost/asio/error.hpp>
  26. #include <boost/asio/wait_traits.hpp>
  27. #include <boost/asio/detail/push_options.hpp>
  28. namespace boost {
  29. namespace asio {
  30. #if !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL)
  31. #define BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL
  32. // Forward declaration with defaulted arguments.
  33. template <typename Clock,
  34. typename WaitTraits = boost::asio::wait_traits<Clock>,
  35. typename Executor = any_io_executor>
  36. class basic_waitable_timer;
  37. #endif // !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL)
  38. /// Provides waitable timer functionality.
  39. /**
  40. * The basic_waitable_timer class template provides the ability to perform a
  41. * blocking or asynchronous wait for a timer to expire.
  42. *
  43. * A waitable timer is always in one of two states: "expired" or "not expired".
  44. * If the wait() or async_wait() function is called on an expired timer, the
  45. * wait operation will complete immediately.
  46. *
  47. * Most applications will use one of the boost::asio::steady_timer,
  48. * boost::asio::system_timer or boost::asio::high_resolution_timer typedefs.
  49. *
  50. * @note This waitable timer functionality is for use with the C++11 standard
  51. * library's @c &lt;chrono&gt; facility, or with the Boost.Chrono library.
  52. *
  53. * @par Thread Safety
  54. * @e Distinct @e objects: Safe.@n
  55. * @e Shared @e objects: Unsafe.
  56. *
  57. * @par Examples
  58. * Performing a blocking wait (C++11):
  59. * @code
  60. * // Construct a timer without setting an expiry time.
  61. * boost::asio::steady_timer timer(my_context);
  62. *
  63. * // Set an expiry time relative to now.
  64. * timer.expires_after(std::chrono::seconds(5));
  65. *
  66. * // Wait for the timer to expire.
  67. * timer.wait();
  68. * @endcode
  69. *
  70. * @par
  71. * Performing an asynchronous wait (C++11):
  72. * @code
  73. * void handler(const boost::system::error_code& error)
  74. * {
  75. * if (!error)
  76. * {
  77. * // Timer expired.
  78. * }
  79. * }
  80. *
  81. * ...
  82. *
  83. * // Construct a timer with an absolute expiry time.
  84. * boost::asio::steady_timer timer(my_context,
  85. * std::chrono::steady_clock::now() + std::chrono::seconds(60));
  86. *
  87. * // Start an asynchronous wait.
  88. * timer.async_wait(handler);
  89. * @endcode
  90. *
  91. * @par Changing an active waitable timer's expiry time
  92. *
  93. * Changing the expiry time of a timer while there are pending asynchronous
  94. * waits causes those wait operations to be cancelled. To ensure that the action
  95. * associated with the timer is performed only once, use something like this:
  96. * used:
  97. *
  98. * @code
  99. * void on_some_event()
  100. * {
  101. * if (my_timer.expires_after(seconds(5)) > 0)
  102. * {
  103. * // We managed to cancel the timer. Start new asynchronous wait.
  104. * my_timer.async_wait(on_timeout);
  105. * }
  106. * else
  107. * {
  108. * // Too late, timer has already expired!
  109. * }
  110. * }
  111. *
  112. * void on_timeout(const boost::system::error_code& e)
  113. * {
  114. * if (e != boost::asio::error::operation_aborted)
  115. * {
  116. * // Timer was not cancelled, take necessary action.
  117. * }
  118. * }
  119. * @endcode
  120. *
  121. * @li The boost::asio::basic_waitable_timer::expires_after() function
  122. * cancels any pending asynchronous waits, and returns the number of
  123. * asynchronous waits that were cancelled. If it returns 0 then you were too
  124. * late and the wait handler has already been executed, or will soon be
  125. * executed. If it returns 1 then the wait handler was successfully cancelled.
  126. *
  127. * @li If a wait handler is cancelled, the boost::system::error_code passed to
  128. * it contains the value boost::asio::error::operation_aborted.
  129. */
  130. template <typename Clock, typename WaitTraits, typename Executor>
  131. class basic_waitable_timer
  132. {
  133. private:
  134. class initiate_async_wait;
  135. public:
  136. /// The type of the executor associated with the object.
  137. typedef Executor executor_type;
  138. /// Rebinds the timer type to another executor.
  139. template <typename Executor1>
  140. struct rebind_executor
  141. {
  142. /// The timer type when rebound to the specified executor.
  143. typedef basic_waitable_timer<Clock, WaitTraits, Executor1> other;
  144. };
  145. /// The clock type.
  146. typedef Clock clock_type;
  147. /// The duration type of the clock.
  148. typedef typename clock_type::duration duration;
  149. /// The time point type of the clock.
  150. typedef typename clock_type::time_point time_point;
  151. /// The wait traits type.
  152. typedef WaitTraits traits_type;
  153. /// Constructor.
  154. /**
  155. * This constructor creates a timer without setting an expiry time. The
  156. * expires_at() or expires_after() functions must be called to set an expiry
  157. * time before the timer can be waited on.
  158. *
  159. * @param ex The I/O executor that the timer will use, by default, to
  160. * dispatch handlers for any asynchronous operations performed on the timer.
  161. */
  162. explicit basic_waitable_timer(const executor_type& ex)
  163. : impl_(0, ex)
  164. {
  165. }
  166. /// Constructor.
  167. /**
  168. * This constructor creates a timer without setting an expiry time. The
  169. * expires_at() or expires_after() functions must be called to set an expiry
  170. * time before the timer can be waited on.
  171. *
  172. * @param context An execution context which provides the I/O executor that
  173. * the timer will use, by default, to dispatch handlers for any asynchronous
  174. * operations performed on the timer.
  175. */
  176. template <typename ExecutionContext>
  177. explicit basic_waitable_timer(ExecutionContext& context,
  178. constraint_t<
  179. is_convertible<ExecutionContext&, execution_context&>::value
  180. > = 0)
  181. : impl_(0, 0, context)
  182. {
  183. }
  184. /// Constructor to set a particular expiry time as an absolute time.
  185. /**
  186. * This constructor creates a timer and sets the expiry time.
  187. *
  188. * @param ex The I/O executor object that the timer will use, by default, to
  189. * dispatch handlers for any asynchronous operations performed on the timer.
  190. *
  191. * @param expiry_time The expiry time to be used for the timer, expressed
  192. * as an absolute time.
  193. */
  194. basic_waitable_timer(const executor_type& ex, const time_point& expiry_time)
  195. : impl_(0, ex)
  196. {
  197. boost::system::error_code ec;
  198. impl_.get_service().expires_at(impl_.get_implementation(), expiry_time, ec);
  199. boost::asio::detail::throw_error(ec, "expires_at");
  200. }
  201. /// Constructor to set a particular expiry time as an absolute time.
  202. /**
  203. * This constructor creates a timer and sets the expiry time.
  204. *
  205. * @param context An execution context which provides the I/O executor that
  206. * the timer will use, by default, to dispatch handlers for any asynchronous
  207. * operations performed on the timer.
  208. *
  209. * @param expiry_time The expiry time to be used for the timer, expressed
  210. * as an absolute time.
  211. */
  212. template <typename ExecutionContext>
  213. explicit basic_waitable_timer(ExecutionContext& context,
  214. const time_point& expiry_time,
  215. constraint_t<
  216. is_convertible<ExecutionContext&, execution_context&>::value
  217. > = 0)
  218. : impl_(0, 0, context)
  219. {
  220. boost::system::error_code ec;
  221. impl_.get_service().expires_at(impl_.get_implementation(), expiry_time, ec);
  222. boost::asio::detail::throw_error(ec, "expires_at");
  223. }
  224. /// Constructor to set a particular expiry time relative to now.
  225. /**
  226. * This constructor creates a timer and sets the expiry time.
  227. *
  228. * @param ex The I/O executor that the timer will use, by default, to
  229. * dispatch handlers for any asynchronous operations performed on the timer.
  230. *
  231. * @param expiry_time The expiry time to be used for the timer, relative to
  232. * now.
  233. */
  234. basic_waitable_timer(const executor_type& ex, const duration& expiry_time)
  235. : impl_(0, ex)
  236. {
  237. boost::system::error_code ec;
  238. impl_.get_service().expires_after(
  239. impl_.get_implementation(), expiry_time, ec);
  240. boost::asio::detail::throw_error(ec, "expires_after");
  241. }
  242. /// Constructor to set a particular expiry time relative to now.
  243. /**
  244. * This constructor creates a timer and sets the expiry time.
  245. *
  246. * @param context An execution context which provides the I/O executor that
  247. * the timer will use, by default, to dispatch handlers for any asynchronous
  248. * operations performed on the timer.
  249. *
  250. * @param expiry_time The expiry time to be used for the timer, relative to
  251. * now.
  252. */
  253. template <typename ExecutionContext>
  254. explicit basic_waitable_timer(ExecutionContext& context,
  255. const duration& expiry_time,
  256. constraint_t<
  257. is_convertible<ExecutionContext&, execution_context&>::value
  258. > = 0)
  259. : impl_(0, 0, context)
  260. {
  261. boost::system::error_code ec;
  262. impl_.get_service().expires_after(
  263. impl_.get_implementation(), expiry_time, ec);
  264. boost::asio::detail::throw_error(ec, "expires_after");
  265. }
  266. /// Move-construct a basic_waitable_timer from another.
  267. /**
  268. * This constructor moves a timer from one object to another.
  269. *
  270. * @param other The other basic_waitable_timer object from which the move will
  271. * occur.
  272. *
  273. * @note Following the move, the moved-from object is in the same state as if
  274. * constructed using the @c basic_waitable_timer(const executor_type&)
  275. * constructor.
  276. */
  277. basic_waitable_timer(basic_waitable_timer&& other)
  278. : impl_(std::move(other.impl_))
  279. {
  280. }
  281. /// Move-assign a basic_waitable_timer from another.
  282. /**
  283. * This assignment operator moves a timer from one object to another. Cancels
  284. * any outstanding asynchronous operations associated with the target object.
  285. *
  286. * @param other The other basic_waitable_timer object from which the move will
  287. * occur.
  288. *
  289. * @note Following the move, the moved-from object is in the same state as if
  290. * constructed using the @c basic_waitable_timer(const executor_type&)
  291. * constructor.
  292. */
  293. basic_waitable_timer& operator=(basic_waitable_timer&& other)
  294. {
  295. impl_ = std::move(other.impl_);
  296. return *this;
  297. }
  298. // All timers have access to each other's implementations.
  299. template <typename Clock1, typename WaitTraits1, typename Executor1>
  300. friend class basic_waitable_timer;
  301. /// Move-construct a basic_waitable_timer from another.
  302. /**
  303. * This constructor moves a timer from one object to another.
  304. *
  305. * @param other The other basic_waitable_timer object from which the move will
  306. * occur.
  307. *
  308. * @note Following the move, the moved-from object is in the same state as if
  309. * constructed using the @c basic_waitable_timer(const executor_type&)
  310. * constructor.
  311. */
  312. template <typename Executor1>
  313. basic_waitable_timer(
  314. basic_waitable_timer<Clock, WaitTraits, Executor1>&& other,
  315. constraint_t<
  316. is_convertible<Executor1, Executor>::value
  317. > = 0)
  318. : impl_(std::move(other.impl_))
  319. {
  320. }
  321. /// Move-assign a basic_waitable_timer from another.
  322. /**
  323. * This assignment operator moves a timer from one object to another. Cancels
  324. * any outstanding asynchronous operations associated with the target object.
  325. *
  326. * @param other The other basic_waitable_timer object from which the move will
  327. * occur.
  328. *
  329. * @note Following the move, the moved-from object is in the same state as if
  330. * constructed using the @c basic_waitable_timer(const executor_type&)
  331. * constructor.
  332. */
  333. template <typename Executor1>
  334. constraint_t<
  335. is_convertible<Executor1, Executor>::value,
  336. basic_waitable_timer&
  337. > operator=(basic_waitable_timer<Clock, WaitTraits, Executor1>&& other)
  338. {
  339. basic_waitable_timer tmp(std::move(other));
  340. impl_ = std::move(tmp.impl_);
  341. return *this;
  342. }
  343. /// Destroys the timer.
  344. /**
  345. * This function destroys the timer, cancelling any outstanding asynchronous
  346. * wait operations associated with the timer as if by calling @c cancel.
  347. */
  348. ~basic_waitable_timer()
  349. {
  350. }
  351. /// Get the executor associated with the object.
  352. const executor_type& get_executor() noexcept
  353. {
  354. return impl_.get_executor();
  355. }
  356. /// Cancel any asynchronous operations that are waiting on the timer.
  357. /**
  358. * This function forces the completion of any pending asynchronous wait
  359. * operations against the timer. The handler for each cancelled operation will
  360. * be invoked with the boost::asio::error::operation_aborted error code.
  361. *
  362. * Cancelling the timer does not change the expiry time.
  363. *
  364. * @return The number of asynchronous operations that were cancelled.
  365. *
  366. * @throws boost::system::system_error Thrown on failure.
  367. *
  368. * @note If the timer has already expired when cancel() is called, then the
  369. * handlers for asynchronous wait operations will:
  370. *
  371. * @li have already been invoked; or
  372. *
  373. * @li have been queued for invocation in the near future.
  374. *
  375. * These handlers can no longer be cancelled, and therefore are passed an
  376. * error code that indicates the successful completion of the wait operation.
  377. */
  378. std::size_t cancel()
  379. {
  380. boost::system::error_code ec;
  381. std::size_t s = impl_.get_service().cancel(impl_.get_implementation(), ec);
  382. boost::asio::detail::throw_error(ec, "cancel");
  383. return s;
  384. }
  385. /// Cancels one asynchronous operation that is waiting on the timer.
  386. /**
  387. * This function forces the completion of one pending asynchronous wait
  388. * operation against the timer. Handlers are cancelled in FIFO order. The
  389. * handler for the cancelled operation will be invoked with the
  390. * boost::asio::error::operation_aborted error code.
  391. *
  392. * Cancelling the timer does not change the expiry time.
  393. *
  394. * @return The number of asynchronous operations that were cancelled. That is,
  395. * either 0 or 1.
  396. *
  397. * @throws boost::system::system_error Thrown on failure.
  398. *
  399. * @note If the timer has already expired when cancel_one() is called, then
  400. * the handlers for asynchronous wait operations will:
  401. *
  402. * @li have already been invoked; or
  403. *
  404. * @li have been queued for invocation in the near future.
  405. *
  406. * These handlers can no longer be cancelled, and therefore are passed an
  407. * error code that indicates the successful completion of the wait operation.
  408. */
  409. std::size_t cancel_one()
  410. {
  411. boost::system::error_code ec;
  412. std::size_t s = impl_.get_service().cancel_one(
  413. impl_.get_implementation(), ec);
  414. boost::asio::detail::throw_error(ec, "cancel_one");
  415. return s;
  416. }
  417. /// Get the timer's expiry time as an absolute time.
  418. /**
  419. * This function may be used to obtain the timer's current expiry time.
  420. * Whether the timer has expired or not does not affect this value.
  421. */
  422. time_point expiry() const
  423. {
  424. return impl_.get_service().expiry(impl_.get_implementation());
  425. }
  426. /// Set the timer's expiry time as an absolute time.
  427. /**
  428. * This function sets the expiry time. Any pending asynchronous wait
  429. * operations will be cancelled. The handler for each cancelled operation will
  430. * be invoked with the boost::asio::error::operation_aborted error code.
  431. *
  432. * @param expiry_time The expiry time to be used for the timer.
  433. *
  434. * @return The number of asynchronous operations that were cancelled.
  435. *
  436. * @throws boost::system::system_error Thrown on failure.
  437. *
  438. * @note If the timer has already expired when expires_at() is called, then
  439. * the handlers for asynchronous wait operations will:
  440. *
  441. * @li have already been invoked; or
  442. *
  443. * @li have been queued for invocation in the near future.
  444. *
  445. * These handlers can no longer be cancelled, and therefore are passed an
  446. * error code that indicates the successful completion of the wait operation.
  447. */
  448. std::size_t expires_at(const time_point& expiry_time)
  449. {
  450. boost::system::error_code ec;
  451. std::size_t s = impl_.get_service().expires_at(
  452. impl_.get_implementation(), expiry_time, ec);
  453. boost::asio::detail::throw_error(ec, "expires_at");
  454. return s;
  455. }
  456. /// Set the timer's expiry time relative to now.
  457. /**
  458. * This function sets the expiry time. Any pending asynchronous wait
  459. * operations will be cancelled. The handler for each cancelled operation will
  460. * be invoked with the boost::asio::error::operation_aborted error code.
  461. *
  462. * @param expiry_time The expiry time to be used for the timer.
  463. *
  464. * @return The number of asynchronous operations that were cancelled.
  465. *
  466. * @throws boost::system::system_error Thrown on failure.
  467. *
  468. * @note If the timer has already expired when expires_after() is called,
  469. * then the handlers for asynchronous wait operations will:
  470. *
  471. * @li have already been invoked; or
  472. *
  473. * @li have been queued for invocation in the near future.
  474. *
  475. * These handlers can no longer be cancelled, and therefore are passed an
  476. * error code that indicates the successful completion of the wait operation.
  477. */
  478. std::size_t expires_after(const duration& expiry_time)
  479. {
  480. boost::system::error_code ec;
  481. std::size_t s = impl_.get_service().expires_after(
  482. impl_.get_implementation(), expiry_time, ec);
  483. boost::asio::detail::throw_error(ec, "expires_after");
  484. return s;
  485. }
  486. /// Perform a blocking wait on the timer.
  487. /**
  488. * This function is used to wait for the timer to expire. This function
  489. * blocks and does not return until the timer has expired.
  490. *
  491. * @throws boost::system::system_error Thrown on failure.
  492. */
  493. void wait()
  494. {
  495. boost::system::error_code ec;
  496. impl_.get_service().wait(impl_.get_implementation(), ec);
  497. boost::asio::detail::throw_error(ec, "wait");
  498. }
  499. /// Perform a blocking wait on the timer.
  500. /**
  501. * This function is used to wait for the timer to expire. This function
  502. * blocks and does not return until the timer has expired.
  503. *
  504. * @param ec Set to indicate what error occurred, if any.
  505. */
  506. void wait(boost::system::error_code& ec)
  507. {
  508. impl_.get_service().wait(impl_.get_implementation(), ec);
  509. }
  510. /// Start an asynchronous wait on the timer.
  511. /**
  512. * This function may be used to initiate an asynchronous wait against the
  513. * timer. It is an initiating function for an @ref asynchronous_operation,
  514. * and always returns immediately.
  515. *
  516. * For each call to async_wait(), the completion handler will be called
  517. * exactly once. The completion handler will be called when:
  518. *
  519. * @li The timer has expired.
  520. *
  521. * @li The timer was cancelled, in which case the handler is passed the error
  522. * code boost::asio::error::operation_aborted.
  523. *
  524. * @param token The @ref completion_token that will be used to produce a
  525. * completion handler, which will be called when the timer expires. Potential
  526. * completion tokens include @ref use_future, @ref use_awaitable, @ref
  527. * yield_context, or a function object with the correct completion signature.
  528. * The function signature of the completion handler must be:
  529. * @code void handler(
  530. * const boost::system::error_code& error // Result of operation.
  531. * ); @endcode
  532. * Regardless of whether the asynchronous operation completes immediately or
  533. * not, the completion handler will not be invoked from within this function.
  534. * On immediate completion, invocation of the handler will be performed in a
  535. * manner equivalent to using boost::asio::async_immediate().
  536. *
  537. * @par Completion Signature
  538. * @code void(boost::system::error_code) @endcode
  539. *
  540. * @par Per-Operation Cancellation
  541. * This asynchronous operation supports cancellation for the following
  542. * boost::asio::cancellation_type values:
  543. *
  544. * @li @c cancellation_type::terminal
  545. *
  546. * @li @c cancellation_type::partial
  547. *
  548. * @li @c cancellation_type::total
  549. */
  550. template <
  551. BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code))
  552. WaitToken = default_completion_token_t<executor_type>>
  553. auto async_wait(
  554. WaitToken&& token = default_completion_token_t<executor_type>())
  555. -> decltype(
  556. async_initiate<WaitToken, void (boost::system::error_code)>(
  557. declval<initiate_async_wait>(), token))
  558. {
  559. return async_initiate<WaitToken, void (boost::system::error_code)>(
  560. initiate_async_wait(this), token);
  561. }
  562. private:
  563. // Disallow copying and assignment.
  564. basic_waitable_timer(const basic_waitable_timer&) = delete;
  565. basic_waitable_timer& operator=(const basic_waitable_timer&) = delete;
  566. class initiate_async_wait
  567. {
  568. public:
  569. typedef Executor executor_type;
  570. explicit initiate_async_wait(basic_waitable_timer* self)
  571. : self_(self)
  572. {
  573. }
  574. const executor_type& get_executor() const noexcept
  575. {
  576. return self_->get_executor();
  577. }
  578. template <typename WaitHandler>
  579. void operator()(WaitHandler&& handler) const
  580. {
  581. // If you get an error on the following line it means that your handler
  582. // does not meet the documented type requirements for a WaitHandler.
  583. BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
  584. detail::non_const_lvalue<WaitHandler> handler2(handler);
  585. self_->impl_.get_service().async_wait(
  586. self_->impl_.get_implementation(),
  587. handler2.value, self_->impl_.get_executor());
  588. }
  589. private:
  590. basic_waitable_timer* self_;
  591. };
  592. detail::io_object_impl<
  593. detail::deadline_timer_service<
  594. detail::chrono_time_traits<Clock, WaitTraits>>,
  595. executor_type > impl_;
  596. };
  597. } // namespace asio
  598. } // namespace boost
  599. #include <boost/asio/detail/pop_options.hpp>
  600. #endif // BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP