Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76380 - in trunk: boost boost/asio boost/asio/detail boost/asio/detail/impl boost/asio/impl libs/asio/doc/overview libs/asio/test
From: chris_at_[hidden]
Date: 2012-01-09 08:43:40


Author: chris_kohlhoff
Date: 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
New Revision: 76380
URL: http://svn.boost.org/trac/boost/changeset/76380

Log:
Chrono support.
Added:
   trunk/boost/asio/basic_waitable_timer.hpp (contents, props changed)
   trunk/boost/asio/detail/chrono_time_traits.hpp (contents, props changed)
   trunk/boost/asio/detail/date_time_fwd.hpp (contents, props changed)
   trunk/boost/asio/detail/impl/timer_queue_ptime.ipp (contents, props changed)
   trunk/boost/asio/detail/timer_queue_ptime.hpp (contents, props changed)
   trunk/boost/asio/high_resolution_timer.hpp (contents, props changed)
   trunk/boost/asio/steady_timer.hpp (contents, props changed)
   trunk/boost/asio/system_timer.hpp (contents, props changed)
   trunk/boost/asio/wait_traits.hpp (contents, props changed)
   trunk/boost/asio/waitable_timer_service.hpp (contents, props changed)
   trunk/libs/asio/test/basic_waitable_timer.cpp (contents, props changed)
   trunk/libs/asio/test/high_resolution_timer.cpp (contents, props changed)
   trunk/libs/asio/test/steady_timer.cpp (contents, props changed)
   trunk/libs/asio/test/system_timer.cpp (contents, props changed)
   trunk/libs/asio/test/wait_traits.cpp (contents, props changed)
   trunk/libs/asio/test/waitable_timer_service.cpp (contents, props changed)
Removed:
   trunk/boost/asio/detail/impl/timer_queue.ipp
Text files modified:
   trunk/boost/asio.hpp | 3
   trunk/boost/asio/deadline_timer_service.hpp | 1
   trunk/boost/asio/detail/config.hpp | 22 ++++++
   trunk/boost/asio/detail/deadline_timer_service.hpp | 24 ++++---
   trunk/boost/asio/detail/timer_queue.hpp | 131 +++++++++++++--------------------------
   trunk/boost/asio/impl/src.hpp | 2
   trunk/libs/asio/doc/overview/cpp2011.qbk | 25 +++++++
   trunk/libs/asio/test/Jamfile.v2 | 12 +++
   8 files changed, 121 insertions(+), 99 deletions(-)

Modified: trunk/boost/asio.hpp
==============================================================================
--- trunk/boost/asio.hpp (original)
+++ trunk/boost/asio.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -29,6 +29,7 @@
 #include <boost/asio/basic_socket_streambuf.hpp>
 #include <boost/asio/basic_stream_socket.hpp>
 #include <boost/asio/basic_streambuf.hpp>
+#include <boost/asio/basic_waitable_timer.hpp>
 #include <boost/asio/buffer.hpp>
 #include <boost/asio/buffered_read_stream_fwd.hpp>
 #include <boost/asio/buffered_read_stream.hpp>
@@ -92,6 +93,8 @@
 #include <boost/asio/streambuf.hpp>
 #include <boost/asio/time_traits.hpp>
 #include <boost/asio/version.hpp>
+#include <boost/asio/wait_traits.hpp>
+#include <boost/asio/waitable_timer_service.hpp>
 #include <boost/asio/windows/basic_handle.hpp>
 #include <boost/asio/windows/basic_random_access_handle.hpp>
 #include <boost/asio/windows/basic_stream_handle.hpp>

Added: trunk/boost/asio/basic_waitable_timer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/basic_waitable_timer.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,518 @@
+//
+// basic_waitable_timer.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP
+#define BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <cstddef>
+#include <boost/asio/basic_io_object.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/wait_traits.hpp>
+#include <boost/asio/waitable_timer_service.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+/// Provides waitable timer functionality.
+/**
+ * The basic_waitable_timer class template provides the ability to perform a
+ * blocking or asynchronous wait for a timer to expire.
+ *
+ * A waitable timer is always in one of two states: "expired" or "not expired".
+ * If the wait() or async_wait() function is called on an expired timer, the
+ * wait operation will complete immediately.
+ *
+ * Most applications will use the boost::asio::waitable_timer typedef.
+ *
+ * @note This waitable timer functionality is for use with the C++11 standard
+ * library's @c <chrono> facility, or with the Boost.Chrono library.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe._at_n
+ * @e Shared @e objects: Unsafe.
+ *
+ * @par Examples
+ * Performing a blocking wait:
+ * @code
+ * // Construct a timer without setting an expiry time.
+ * boost::asio::waitable_timer timer(io_service);
+ *
+ * // Set an expiry time relative to now.
+ * timer.expires_from_now(boost::posix_time::seconds(5));
+ *
+ * // Wait for the timer to expire.
+ * timer.wait();
+ * @endcode
+ *
+ * @par
+ * Performing an asynchronous wait:
+ * @code
+ * void handler(const boost::system::error_code& error)
+ * {
+ * if (!error)
+ * {
+ * // Timer expired.
+ * }
+ * }
+ *
+ * ...
+ *
+ * // Construct a timer with an absolute expiry time.
+ * boost::asio::waitable_timer timer(io_service,
+ * boost::posix_time::time_from_string("2005-12-07 23:59:59.000"));
+ *
+ * // Start an asynchronous wait.
+ * timer.async_wait(handler);
+ * @endcode
+ *
+ * @par Changing an active waitable_timer's expiry time
+ *
+ * Changing the expiry time of a timer while there are pending asynchronous
+ * waits causes those wait operations to be cancelled. To ensure that the action
+ * associated with the timer is performed only once, use something like this:
+ * used:
+ *
+ * @code
+ * void on_some_event()
+ * {
+ * if (my_timer.expires_from_now(seconds(5)) > 0)
+ * {
+ * // We managed to cancel the timer. Start new asynchronous wait.
+ * my_timer.async_wait(on_timeout);
+ * }
+ * else
+ * {
+ * // Too late, timer has already expired!
+ * }
+ * }
+ *
+ * void on_timeout(const boost::system::error_code& e)
+ * {
+ * if (e != boost::asio::error::operation_aborted)
+ * {
+ * // Timer was not cancelled, take necessary action.
+ * }
+ * }
+ * @endcode
+ *
+ * @li The boost::asio::basic_waitable_timer::expires_from_now() 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
+ * executed. If it returns 1 then the wait handler was successfully cancelled.
+ *
+ * @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> >
+class basic_waitable_timer
+ : public basic_io_object<WaitableTimerService>
+{
+public:
+ /// 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;
+
+ /// The wait traits type.
+ typedef WaitTraits traits_type;
+
+ /// 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.
+ *
+ * @param io_service The io_service object that the timer will use 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)
+ {
+ }
+
+ /// Constructor to set a particular expiry time as an absolute time.
+ /**
+ * 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 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)
+ {
+ boost::system::error_code ec;
+ this->service.expires_at(this->implementation, expiry_time, ec);
+ boost::asio::detail::throw_error(ec, "expires_at");
+ }
+
+ /// Constructor to set a particular expiry time relative to now.
+ /**
+ * 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 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)
+ {
+ boost::system::error_code ec;
+ this->service.expires_from_now(this->implementation, expiry_time, ec);
+ boost::asio::detail::throw_error(ec, "expires_from_now");
+ }
+
+ /// 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
+ * be invoked with the boost::asio::error::operation_aborted error code.
+ *
+ * Cancelling the timer does not change the expiry time.
+ *
+ * @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 cancel() 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 cancel()
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->service.cancel(this->implementation, ec);
+ boost::asio::detail::throw_error(ec, "cancel");
+ return s;
+ }
+
+ /// 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
+ * be invoked with the boost::asio::error::operation_aborted error code.
+ *
+ * Cancelling the timer does not change the expiry time.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @return The number of asynchronous operations that were cancelled.
+ *
+ * @note If the timer has already expired when cancel() 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 cancel(boost::system::error_code& ec)
+ {
+ return this->service.cancel(this->implementation, ec);
+ }
+
+ /// 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
+ * handler for the cancelled operation will be invoked with the
+ * boost::asio::error::operation_aborted error code.
+ *
+ * Cancelling the timer does not change the expiry time.
+ *
+ * @return The number of asynchronous operations that were cancelled. That is,
+ * either 0 or 1.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note If the timer has already expired when cancel_one() 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 cancel_one()
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->service.cancel_one(this->implementation, ec);
+ boost::asio::detail::throw_error(ec, "cancel_one");
+ return s;
+ }
+
+ /// 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
+ * handler for the cancelled operation will be invoked with the
+ * boost::asio::error::operation_aborted error code.
+ *
+ * Cancelling the timer does not change the expiry time.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @return The number of asynchronous operations that were cancelled. That is,
+ * either 0 or 1.
+ *
+ * @note If the timer has already expired when cancel_one() 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 cancel_one(boost::system::error_code& ec)
+ {
+ return this->service.cancel_one(this->implementation, ec);
+ }
+
+ /// 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);
+ }
+
+ /// 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
+ * 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_at() 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_at(const time_point& expiry_time)
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->service.expires_at(
+ this->implementation, expiry_time, ec);
+ boost::asio::detail::throw_error(ec, "expires_at");
+ return s;
+ }
+
+ /// 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
+ * be invoked with the boost::asio::error::operation_aborted error code.
+ *
+ * @param expiry_time The expiry time to be used for the timer.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @return The number of asynchronous operations that were cancelled.
+ *
+ * @note If the timer has already expired when expires_at() 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_at(const time_point& expiry_time,
+ boost::system::error_code& ec)
+ {
+ return this->service.expires_at(this->implementation, expiry_time, ec);
+ }
+
+ /// 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);
+ }
+
+ /// 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_from_now() 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_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);
+ boost::asio::detail::throw_error(ec, "expires_from_now");
+ return s;
+ }
+
+ /// 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.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @return The number of asynchronous operations that were cancelled.
+ *
+ * @note If the timer has already expired when expires_from_now() 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_from_now(const duration& expiry_time,
+ boost::system::error_code& ec)
+ {
+ return this->service.expires_from_now(
+ this->implementation, expiry_time, ec);
+ }
+
+ /// Perform a blocking wait on the timer.
+ /**
+ * This function is used to wait for the timer to expire. This function
+ * blocks and does not return until the timer has expired.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void wait()
+ {
+ boost::system::error_code ec;
+ this->service.wait(this->implementation, ec);
+ boost::asio::detail::throw_error(ec, "wait");
+ }
+
+ /// Perform a blocking wait on the timer.
+ /**
+ * This function is used to wait for the timer to expire. This function
+ * blocks and does not return until the timer has expired.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ void wait(boost::system::error_code& ec)
+ {
+ this->service.wait(this->implementation, ec);
+ }
+
+ /// Start an asynchronous wait on the timer.
+ /**
+ * This function may be used to initiate an asynchronous wait against the
+ * timer. It always returns immediately.
+ *
+ * For each call to async_wait(), the supplied handler will be called exactly
+ * once. The handler will be called when:
+ *
+ * @li The timer has expired.
+ *
+ * @li The timer was cancelled, in which case the handler is passed the error
+ * code boost::asio::error::operation_aborted.
+ *
+ * @param handler The handler to be called when the timer expires. Copies
+ * will be made of the handler as required. The function signature of the
+ * handler must be:
+ * @code void handler(
+ * 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().
+ */
+ template <typename WaitHandler>
+ void 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;
+
+ this->service.async_wait(this->implementation,
+ BOOST_ASIO_MOVE_CAST(WaitHandler)(handler));
+ }
+};
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP

Modified: trunk/boost/asio/deadline_timer_service.hpp
==============================================================================
--- trunk/boost/asio/deadline_timer_service.hpp (original)
+++ trunk/boost/asio/deadline_timer_service.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -20,6 +20,7 @@
 #include <boost/asio/detail/deadline_timer_service.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/time_traits.hpp>
+#include <boost/asio/detail/timer_queue_ptime.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
 

Added: trunk/boost/asio/detail/chrono_time_traits.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/detail/chrono_time_traits.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,129 @@
+//
+// detail/chrono_time_traits.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_CHRONO_TIME_TRAITS_HPP
+#define BOOST_ASIO_DETAIL_CHRONO_TIME_TRAITS_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/cstdint.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+// Adapts std::chrono clocks for use with a deadline timer.
+template <typename Clock, typename WaitTraits>
+struct chrono_time_traits
+{
+ // The clock type.
+ typedef Clock clock_type;
+
+ // The duration type of the clock.
+ typedef typename clock_type::duration duration_type;
+
+ // The time point type of the clock.
+ typedef typename clock_type::time_point time_type;
+
+ // The period of the clock.
+ typedef typename duration_type::period period_type;
+
+ // Get the current time.
+ static time_type now()
+ {
+ return clock_type::now();
+ }
+
+ // Add a duration to a time.
+ static time_type add(const time_type& t, const duration_type& d)
+ {
+ return t + d;
+ }
+
+ // Subtract one time from another.
+ static duration_type subtract(const time_type& t1, const time_type& t2)
+ {
+ return t1 - t2;
+ }
+
+ // Test whether one time is less than another.
+ static bool less_than(const time_type& t1, const time_type& t2)
+ {
+ return t1 < t2;
+ }
+
+ // Implement just enough of the posix_time::time_duration interface to supply
+ // what the timer_queue requires.
+ class posix_time_duration
+ {
+ public:
+ explicit posix_time_duration(const duration_type& d)
+ : d_(d)
+ {
+ }
+
+ boost::int64_t ticks() const
+ {
+ return d_.count();
+ }
+
+ boost::int64_t total_seconds() const
+ {
+ return duration_cast<1, 1>();
+ }
+
+ boost::int64_t total_milliseconds() const
+ {
+ return duration_cast<1, 1000>();
+ }
+
+ boost::int64_t total_microseconds() const
+ {
+ return duration_cast<1, 1000000>();
+ }
+
+ private:
+ template <boost::int64_t Num, boost::int64_t Den>
+ boost::int64_t duration_cast() const
+ {
+ const boost::int64_t num = period_type::num * Den;
+ const boost::int64_t den = period_type::den * Num;
+
+ if (num == 1 && den == 1)
+ return ticks();
+ else if (num != 1 && den == 1)
+ return ticks() * num;
+ else if (num == 1 && period_type::den != 1)
+ return ticks() / den;
+ else
+ return ticks() * num / den;
+ }
+
+ duration_type d_;
+ };
+
+ // Convert to POSIX duration type.
+ static posix_time_duration to_posix_duration(const duration_type& d)
+ {
+ return posix_time_duration(WaitTraits::to_wait_duration(d));
+ }
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_CHRONO_TIME_TRAITS_HPP

Modified: trunk/boost/asio/detail/config.hpp
==============================================================================
--- trunk/boost/asio/detail/config.hpp (original)
+++ trunk/boost/asio/detail/config.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -12,6 +12,7 @@
 #define BOOST_ASIO_DETAIL_CONFIG_HPP
 
 #include <boost/config.hpp>
+#include <boost/version.hpp>
 
 // Default to a header-only implementation. The user must specifically request
 // separate compilation by defining either BOOST_ASIO_SEPARATE_COMPILATION or
@@ -154,6 +155,27 @@
 # endif // defined(__GNUC__)
 #endif // !defined(BOOST_ASIO_DISABLE_STD_ATOMIC)
 
+// Standard library support for chrono. Some standard libraries (such as the
+// libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
+// drafts, rather than the eventually standardised name of steady_clock.
+#if !defined(BOOST_ASIO_DISABLE_STD_CHRONO)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_STD_CHRONO
+# define BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+#endif // !defined(BOOST_ASIO_DISABLE_STD_CHRONO)
+
+// Boost support for chrono.
+#if !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
+# if (BOOST_VERSION >= 104700)
+# define BOOST_ASIO_HAS_BOOST_CHRONO
+# endif // (BOOST_VERSION >= 104700)
+#endif // !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
+
 // Windows: target OS version.
 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
 # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)

Added: trunk/boost/asio/detail/date_time_fwd.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/detail/date_time_fwd.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,34 @@
+//
+// detail/date_time_fwd.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP
+#define BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+namespace boost {
+namespace date_time {
+
+template<class T, class TimeSystem>
+class base_time;
+
+} // namespace date_time
+namespace posix_time {
+
+class ptime;
+
+} // namespace posix_time
+} // namespace boost
+
+#endif // BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP

Modified: trunk/boost/asio/detail/deadline_timer_service.hpp
==============================================================================
--- trunk/boost/asio/detail/deadline_timer_service.hpp (original)
+++ trunk/boost/asio/detail/deadline_timer_service.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -30,10 +30,6 @@
 #include <boost/asio/detail/wait_handler.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
-#include <boost/asio/detail/pop_options.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
 
 namespace boost {
 namespace asio {
@@ -166,12 +162,8 @@
     ec = boost::system::error_code();
     while (Time_Traits::less_than(now, impl.expiry) && !ec)
     {
- boost::posix_time::time_duration timeout =
- Time_Traits::to_posix_duration(Time_Traits::subtract(impl.expiry, now));
- ::timeval tv;
- tv.tv_sec = timeout.total_seconds();
- tv.tv_usec = timeout.total_microseconds() % 1000000;
- socket_ops::select(0, 0, 0, 0, &tv, ec);
+ this->do_wait(Time_Traits::to_posix_duration(
+ Time_Traits::subtract(impl.expiry, now)), ec);
       now = Time_Traits::now();
     }
   }
@@ -196,6 +188,18 @@
   }
 
 private:
+ // Helper function to wait given a duration type. The duration type should
+ // either be of type boost::posix_time::time_duration, or implement the
+ // required subset of its interface.
+ template <typename Duration>
+ void do_wait(const Duration& timeout, boost::system::error_code& ec)
+ {
+ ::timeval tv;
+ tv.tv_sec = timeout.total_seconds();
+ tv.tv_usec = timeout.total_microseconds() % 1000000;
+ socket_ops::select(0, 0, 0, 0, &tv, ec);
+ }
+
   // The queue of timers.
   timer_queue<Time_Traits> timer_queue_;
 

Deleted: trunk/boost/asio/detail/impl/timer_queue.ipp
==============================================================================
--- trunk/boost/asio/detail/impl/timer_queue.ipp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
+++ (empty file)
@@ -1,87 +0,0 @@
-//
-// detail/impl/timer_queue.ipp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2011 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)
-//
-
-#ifndef BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_IPP
-#define BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_IPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-
-#if !defined(BOOST_ASIO_HEADER_ONLY)
-
-#include <boost/asio/detail/timer_queue.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace detail {
-
-timer_queue<time_traits<boost::posix_time::ptime> >::timer_queue()
-{
-}
-
-timer_queue<time_traits<boost::posix_time::ptime> >::~timer_queue()
-{
-}
-
-bool timer_queue<time_traits<boost::posix_time::ptime> >::enqueue_timer(
- const time_type& time, per_timer_data& timer, timer_op* op)
-{
- return impl_.enqueue_timer(time, timer, op);
-}
-
-bool timer_queue<time_traits<boost::posix_time::ptime> >::empty() const
-{
- return impl_.empty();
-}
-
-long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_msec(
- long max_duration) const
-{
- return impl_.wait_duration_msec(max_duration);
-}
-
-long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_usec(
- long max_duration) const
-{
- return impl_.wait_duration_usec(max_duration);
-}
-
-void timer_queue<time_traits<boost::posix_time::ptime> >::get_ready_timers(
- op_queue<operation>& ops)
-{
- impl_.get_ready_timers(ops);
-}
-
-void timer_queue<time_traits<boost::posix_time::ptime> >::get_all_timers(
- op_queue<operation>& ops)
-{
- impl_.get_all_timers(ops);
-}
-
-std::size_t timer_queue<time_traits<boost::posix_time::ptime> >::cancel_timer(
- per_timer_data& timer, op_queue<operation>& ops, std::size_t max_cancelled)
-{
- return impl_.cancel_timer(timer, ops, max_cancelled);
-}
-
-} // namespace detail
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // !defined(BOOST_ASIO_HEADER_ONLY)
-
-#endif // BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_IPP

Added: trunk/boost/asio/detail/impl/timer_queue_ptime.ipp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/detail/impl/timer_queue_ptime.ipp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,82 @@
+//
+// detail/impl/timer_queue_ptime.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP
+#define BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/timer_queue_ptime.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+timer_queue<time_traits<boost::posix_time::ptime> >::timer_queue()
+{
+}
+
+timer_queue<time_traits<boost::posix_time::ptime> >::~timer_queue()
+{
+}
+
+bool timer_queue<time_traits<boost::posix_time::ptime> >::enqueue_timer(
+ const time_type& time, per_timer_data& timer, timer_op* op)
+{
+ return impl_.enqueue_timer(time, timer, op);
+}
+
+bool timer_queue<time_traits<boost::posix_time::ptime> >::empty() const
+{
+ return impl_.empty();
+}
+
+long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_msec(
+ long max_duration) const
+{
+ return impl_.wait_duration_msec(max_duration);
+}
+
+long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_usec(
+ long max_duration) const
+{
+ return impl_.wait_duration_usec(max_duration);
+}
+
+void timer_queue<time_traits<boost::posix_time::ptime> >::get_ready_timers(
+ op_queue<operation>& ops)
+{
+ impl_.get_ready_timers(ops);
+}
+
+void timer_queue<time_traits<boost::posix_time::ptime> >::get_all_timers(
+ op_queue<operation>& ops)
+{
+ impl_.get_all_timers(ops);
+}
+
+std::size_t timer_queue<time_traits<boost::posix_time::ptime> >::cancel_timer(
+ per_timer_data& timer, op_queue<operation>& ops, std::size_t max_cancelled)
+{
+ return impl_.cancel_timer(timer, ops, max_cancelled);
+}
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP

Modified: trunk/boost/asio/detail/timer_queue.hpp
==============================================================================
--- trunk/boost/asio/detail/timer_queue.hpp (original)
+++ trunk/boost/asio/detail/timer_queue.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -20,15 +20,12 @@
 #include <vector>
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/asio/detail/date_time_fwd.hpp>
 #include <boost/asio/detail/op_queue.hpp>
 #include <boost/asio/detail/timer_op.hpp>
 #include <boost/asio/detail/timer_queue_base.hpp>
 #include <boost/asio/error.hpp>
-#include <boost/asio/time_traits.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
-#include <boost/asio/detail/pop_options.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -124,17 +121,10 @@
     if (heap_.empty())
       return max_duration;
 
- boost::posix_time::time_duration duration = Time_Traits::to_posix_duration(
- Time_Traits::subtract(heap_[0].time_, Time_Traits::now()));
-
- if (duration > boost::posix_time::milliseconds(max_duration))
- duration = boost::posix_time::milliseconds(max_duration);
- else if (duration <= boost::posix_time::milliseconds(0))
- duration = boost::posix_time::milliseconds(0);
- else if (duration < boost::posix_time::milliseconds(1))
- duration = boost::posix_time::milliseconds(1);
-
- return duration.total_milliseconds();
+ return this->to_msec(
+ Time_Traits::to_posix_duration(
+ Time_Traits::subtract(heap_[0].time_, Time_Traits::now())),
+ max_duration);
   }
 
   // Get the time for the timer that is earliest in the queue.
@@ -143,17 +133,10 @@
     if (heap_.empty())
       return max_duration;
 
- boost::posix_time::time_duration duration = Time_Traits::to_posix_duration(
- Time_Traits::subtract(heap_[0].time_, Time_Traits::now()));
-
- if (duration > boost::posix_time::microseconds(max_duration))
- duration = boost::posix_time::microseconds(max_duration);
- else if (duration <= boost::posix_time::microseconds(0))
- duration = boost::posix_time::microseconds(0);
- else if (duration < boost::posix_time::microseconds(1))
- duration = boost::posix_time::microseconds(1);
-
- return duration.total_microseconds();
+ return this->to_usec(
+ Time_Traits::to_posix_duration(
+ Time_Traits::subtract(heap_[0].time_, Time_Traits::now())),
+ max_duration);
   }
 
   // Dequeue all timers not later than the current time.
@@ -292,9 +275,39 @@
   }
 
   // Determine if the specified absolute time is positive infinity.
- static bool is_positive_infinity(const boost::posix_time::ptime& time)
- {
- return time == boost::posix_time::pos_infin;
+ template <typename T, typename TimeSystem>
+ static bool is_positive_infinity(
+ const boost::date_time::base_time<T, TimeSystem>& time)
+ {
+ return time.is_pos_infinity();
+ }
+
+ // Helper function to convert a duration into milliseconds.
+ template <typename Duration>
+ long to_msec(const Duration& d, long max_duration) const
+ {
+ if (d.ticks() <= 0)
+ return 0;
+ boost::int64_t msec = d.total_milliseconds();
+ if (msec == 0)
+ return 1;
+ if (msec > max_duration)
+ return max_duration;
+ return static_cast<long>(msec);
+ }
+
+ // Helper function to convert a duration into microseconds.
+ template <typename Duration>
+ long to_usec(const Duration& d, long max_duration) const
+ {
+ if (d.ticks() <= 0)
+ return 0;
+ boost::int64_t usec = d.total_microseconds();
+ if (usec == 0)
+ return 1;
+ if (usec > max_duration)
+ return max_duration;
+ return static_cast<long>(usec);
   }
 
   // The head of a linked list of all active timers.
@@ -313,64 +326,6 @@
   std::vector<heap_entry> heap_;
 };
 
-#if !defined(BOOST_ASIO_HEADER_ONLY)
-
-struct forwarding_posix_time_traits : time_traits<boost::posix_time::ptime> {};
-
-// Template specialisation for the commonly used instantation.
-template <>
-class timer_queue<time_traits<boost::posix_time::ptime> >
- : public timer_queue_base
-{
-public:
- // The time type.
- typedef boost::posix_time::ptime time_type;
-
- // The duration type.
- typedef boost::posix_time::time_duration duration_type;
-
- // Per-timer data.
- typedef timer_queue<forwarding_posix_time_traits>::per_timer_data
- per_timer_data;
-
- // Constructor.
- BOOST_ASIO_DECL timer_queue();
-
- // Destructor.
- BOOST_ASIO_DECL virtual ~timer_queue();
-
- // Add a new timer to the queue. Returns true if this is the timer that is
- // earliest in the queue, in which case the reactor's event demultiplexing
- // function call may need to be interrupted and restarted.
- BOOST_ASIO_DECL bool enqueue_timer(const time_type& time,
- per_timer_data& timer, timer_op* op);
-
- // Whether there are no timers in the queue.
- BOOST_ASIO_DECL virtual bool empty() const;
-
- // Get the time for the timer that is earliest in the queue.
- BOOST_ASIO_DECL virtual long wait_duration_msec(long max_duration) const;
-
- // Get the time for the timer that is earliest in the queue.
- BOOST_ASIO_DECL virtual long wait_duration_usec(long max_duration) const;
-
- // Dequeue all timers not later than the current time.
- BOOST_ASIO_DECL virtual void get_ready_timers(op_queue<operation>& ops);
-
- // Dequeue all timers.
- BOOST_ASIO_DECL virtual void get_all_timers(op_queue<operation>& ops);
-
- // Cancel and dequeue operations for the given timer.
- BOOST_ASIO_DECL std::size_t cancel_timer(
- per_timer_data& timer, op_queue<operation>& ops,
- std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
-
-private:
- timer_queue<forwarding_posix_time_traits> impl_;
-};
-
-#endif // !defined(BOOST_ASIO_HEADER_ONLY)
-
 } // namespace detail
 } // namespace asio
 } // namespace boost

Added: trunk/boost/asio/detail/timer_queue_ptime.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/detail/timer_queue_ptime.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,91 @@
+//
+// detail/timer_queue_ptime.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP
+#define BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/time_traits.hpp>
+#include <boost/asio/detail/timer_queue.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+struct forwarding_posix_time_traits : time_traits<boost::posix_time::ptime> {};
+
+// Template specialisation for the commonly used instantation.
+template <>
+class timer_queue<time_traits<boost::posix_time::ptime> >
+ : public timer_queue_base
+{
+public:
+ // The time type.
+ typedef boost::posix_time::ptime time_type;
+
+ // The duration type.
+ typedef boost::posix_time::time_duration duration_type;
+
+ // Per-timer data.
+ typedef timer_queue<forwarding_posix_time_traits>::per_timer_data
+ per_timer_data;
+
+ // Constructor.
+ BOOST_ASIO_DECL timer_queue();
+
+ // Destructor.
+ BOOST_ASIO_DECL virtual ~timer_queue();
+
+ // Add a new timer to the queue. Returns true if this is the timer that is
+ // earliest in the queue, in which case the reactor's event demultiplexing
+ // function call may need to be interrupted and restarted.
+ BOOST_ASIO_DECL bool enqueue_timer(const time_type& time,
+ per_timer_data& timer, timer_op* op);
+
+ // Whether there are no timers in the queue.
+ BOOST_ASIO_DECL virtual bool empty() const;
+
+ // Get the time for the timer that is earliest in the queue.
+ BOOST_ASIO_DECL virtual long wait_duration_msec(long max_duration) const;
+
+ // Get the time for the timer that is earliest in the queue.
+ BOOST_ASIO_DECL virtual long wait_duration_usec(long max_duration) const;
+
+ // Dequeue all timers not later than the current time.
+ BOOST_ASIO_DECL virtual void get_ready_timers(op_queue<operation>& ops);
+
+ // Dequeue all timers.
+ BOOST_ASIO_DECL virtual void get_all_timers(op_queue<operation>& ops);
+
+ // Cancel and dequeue operations for the given timer.
+ BOOST_ASIO_DECL std::size_t cancel_timer(
+ per_timer_data& timer, op_queue<operation>& ops,
+ std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
+
+private:
+ timer_queue<forwarding_posix_time_traits> impl_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/detail/impl/timer_queue_ptime.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
+#endif // BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP

Added: trunk/boost/asio/high_resolution_timer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/high_resolution_timer.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,65 @@
+//
+// high_resolution_timer.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_HIGH_RESOLUTION_TIMER_HPP
+#define BOOST_ASIO_HIGH_RESOLUTION_TIMER_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_STD_CHRONO) \
+ || defined(BOOST_ASIO_HAS_BOOST_CHRONO) \
+ || defined(GENERATING_DOCUMENTATION)
+
+#if defined(BOOST_ASIO_HAS_STD_CHRONO)
+# include <chrono>
+#elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+# include <boost/chrono/system_clocks.hpp>
+#endif
+
+#include <boost/asio/basic_waitable_timer.hpp>
+
+namespace boost {
+namespace asio {
+
+#if defined(GENERATING_DOCUMENTATION)
+/// Typedef for a timer based on the high resolution clock.
+/**
+ * This typedef uses the C++11 @c <chrono> standard library facility, if
+ * available. Otherwise, it may use the Boost.Chrono library. To explicitly
+ * utilise Boost.Chrono, use the basic_waitable_timer template directly:
+ * @code
+ * typedef basic_waitable_timer<boost::chrono::high_resolution_clock> timer;
+ * @endcode
+ */
+typedef basic_waitable_timer<
+ chrono::high_resolution_clock>
+ high_resolution_timer;
+#elif defined(BOOST_ASIO_HAS_STD_CHRONO)
+typedef basic_waitable_timer<
+ std::chrono::high_resolution_clock>
+ high_resolution_timer;
+#elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+typedef basic_waitable_timer<
+ boost::chrono::high_resolution_clock>
+ high_resolution_timer;
+#endif
+
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_STD_CHRONO)
+ // || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#endif // BOOST_ASIO_HIGH_RESOLUTION_TIMER_HPP

Modified: trunk/boost/asio/impl/src.hpp
==============================================================================
--- trunk/boost/asio/impl/src.hpp (original)
+++ trunk/boost/asio/impl/src.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -45,7 +45,7 @@
 #include <boost/asio/detail/impl/strand_service.ipp>
 #include <boost/asio/detail/impl/task_io_service.ipp>
 #include <boost/asio/detail/impl/throw_error.ipp>
-#include <boost/asio/detail/impl/timer_queue.ipp>
+#include <boost/asio/detail/impl/timer_queue_ptime.ipp>
 #include <boost/asio/detail/impl/timer_queue_set.ipp>
 #include <boost/asio/detail/impl/win_iocp_handle_service.ipp>
 #include <boost/asio/detail/impl/win_iocp_io_service.ipp>

Added: trunk/boost/asio/steady_timer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/steady_timer.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,63 @@
+//
+// steady_timer.hpp
+// ~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_STEADY_TIMER_HPP
+#define BOOST_ASIO_STEADY_TIMER_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_STD_CHRONO) \
+ || defined(BOOST_ASIO_HAS_BOOST_CHRONO) \
+ || defined(GENERATING_DOCUMENTATION)
+
+#if defined(BOOST_ASIO_HAS_STD_CHRONO)
+# include <chrono>
+#elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+# include <boost/chrono/system_clocks.hpp>
+#endif
+
+#include <boost/asio/basic_waitable_timer.hpp>
+
+namespace boost {
+namespace asio {
+
+#if defined(GENERATING_DOCUMENTATION)
+/// Typedef for a timer based on the steady clock.
+/**
+ * This typedef uses the C++11 @c <chrono> standard library facility, if
+ * available. Otherwise, it may use the Boost.Chrono library. To explicitly
+ * utilise Boost.Chrono, use the basic_waitable_timer template directly:
+ * @code
+ * typedef basic_waitable_timer<boost::chrono::steady_clock> timer;
+ * @endcode
+ */
+typedef basic_waitable_timer<chrono::steady_clock> steady_timer;
+#elif defined(BOOST_ASIO_HAS_STD_CHRONO)
+# if defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK)
+typedef basic_waitable_timer<std::chrono::monotonic_clock> steady_timer;
+# else // defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK)
+typedef basic_waitable_timer<std::chrono::steady_clock> steady_timer;
+# endif // defined(BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK)
+#elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+typedef basic_waitable_timer<boost::chrono::steady_clock> steady_timer;
+#endif
+
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_STD_CHRONO)
+ // || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#endif // BOOST_ASIO_STEADY_TIMER_HPP

Added: trunk/boost/asio/system_timer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/system_timer.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,59 @@
+//
+// system_timer.hpp
+// ~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SYSTEM_TIMER_HPP
+#define BOOST_ASIO_SYSTEM_TIMER_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_STD_CHRONO) \
+ || defined(BOOST_ASIO_HAS_BOOST_CHRONO) \
+ || defined(GENERATING_DOCUMENTATION)
+
+#if defined(BOOST_ASIO_HAS_STD_CHRONO)
+# include <chrono>
+#elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+# include <boost/chrono/system_clocks.hpp>
+#endif
+
+#include <boost/asio/basic_waitable_timer.hpp>
+
+namespace boost {
+namespace asio {
+
+#if defined(GENERATING_DOCUMENTATION)
+/// Typedef for a timer based on the system clock.
+/**
+ * This typedef uses the C++11 @c <chrono> standard library facility, if
+ * available. Otherwise, it may use the Boost.Chrono library. To explicitly
+ * utilise Boost.Chrono, use the basic_waitable_timer template directly:
+ * @code
+ * typedef basic_waitable_timer<boost::chrono::system_clock> timer;
+ * @endcode
+ */
+typedef basic_waitable_timer<chrono::system_clock> system_timer;
+#elif defined(BOOST_ASIO_HAS_STD_CHRONO)
+typedef basic_waitable_timer<std::chrono::system_clock> system_timer;
+#elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+typedef basic_waitable_timer<boost::chrono::system_clock> system_timer;
+#endif
+
+} // namespace asio
+} // namespace boost
+
+#endif // defined(BOOST_ASIO_HAS_STD_CHRONO)
+ // || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+ // || defined(GENERATING_DOCUMENTATION)
+
+#endif // BOOST_ASIO_SYSTEM_TIMER_HPP

Added: trunk/boost/asio/wait_traits.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/wait_traits.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,43 @@
+//
+// wait_traits.hpp
+// ~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_WAIT_TRAITS_HPP
+#define BOOST_ASIO_WAIT_TRAITS_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+/// Wait traits suitable for use with the basic_waitable_timer class template.
+template <typename Clock>
+struct wait_traits
+{
+ /// Convert a clock duration into a duration used for waiting.
+ /**
+ * @returns @c d.
+ */
+ static typename Clock::duration to_wait_duration(
+ const typename Clock::duration& d)
+ {
+ return d;
+ }
+};
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WAIT_TRAITS_HPP

Added: trunk/boost/asio/waitable_timer_service.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/asio/waitable_timer_service.hpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,161 @@
+//
+// waitable_timer_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP
+#define BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <cstddef>
+#include <boost/asio/detail/chrono_time_traits.hpp>
+#include <boost/asio/detail/deadline_timer_service.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/wait_traits.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+/// Default service implementation for a timer.
+template <typename Clock,
+ typename WaitTraits = boost::asio::wait_traits<Clock> >
+class waitable_timer_service
+#if defined(GENERATING_DOCUMENTATION)
+ : public boost::asio::io_service::service
+#else
+ : public boost::asio::detail::service_base<
+ waitable_timer_service<Clock, WaitTraits> >
+#endif
+{
+public:
+#if defined(GENERATING_DOCUMENTATION)
+ /// The unique service identifier.
+ static boost::asio::io_service::id id;
+#endif
+
+ /// 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;
+
+ /// The wait traits type.
+ typedef WaitTraits traits_type;
+
+private:
+ // The type of the platform-specific implementation.
+ typedef detail::deadline_timer_service<
+ detail::chrono_time_traits<Clock, WaitTraits> > service_impl_type;
+
+public:
+ /// The implementation type of the waitable timer.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined implementation_type;
+#else
+ typedef typename service_impl_type::implementation_type implementation_type;
+#endif
+
+ /// Construct a new timer service for the specified io_service.
+ explicit waitable_timer_service(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<
+ waitable_timer_service<Clock, WaitTraits> >(io_service),
+ service_impl_(io_service)
+ {
+ }
+
+ /// Construct a new timer implementation.
+ void construct(implementation_type& impl)
+ {
+ service_impl_.construct(impl);
+ }
+
+ /// Destroy a timer implementation.
+ void destroy(implementation_type& impl)
+ {
+ service_impl_.destroy(impl);
+ }
+
+ /// Cancel any asynchronous wait operations associated with the timer.
+ std::size_t cancel(implementation_type& impl, boost::system::error_code& ec)
+ {
+ return service_impl_.cancel(impl, ec);
+ }
+
+ /// Cancels one asynchronous wait operation associated with the timer.
+ std::size_t cancel_one(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.cancel_one(impl, ec);
+ }
+
+ /// Get the expiry time for the timer as an absolute time.
+ time_point expires_at(const implementation_type& impl) const
+ {
+ return service_impl_.expires_at(impl);
+ }
+
+ /// Set the expiry time for the timer as an absolute time.
+ std::size_t expires_at(implementation_type& impl,
+ const time_point& expiry_time, boost::system::error_code& ec)
+ {
+ return service_impl_.expires_at(impl, expiry_time, ec);
+ }
+
+ /// Get the expiry time for the timer relative to now.
+ duration expires_from_now(const implementation_type& impl) const
+ {
+ return service_impl_.expires_from_now(impl);
+ }
+
+ /// Set the expiry time for the timer relative to now.
+ std::size_t expires_from_now(implementation_type& impl,
+ const duration& expiry_time, boost::system::error_code& ec)
+ {
+ return service_impl_.expires_from_now(impl, expiry_time, ec);
+ }
+
+ // Perform a blocking wait on the timer.
+ void wait(implementation_type& impl, boost::system::error_code& ec)
+ {
+ service_impl_.wait(impl, ec);
+ }
+
+ // Start an asynchronous wait on the timer.
+ template <typename WaitHandler>
+ void async_wait(implementation_type& impl,
+ BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
+ {
+ service_impl_.async_wait(impl, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler));
+ }
+
+private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
+ // The platform-specific implementation.
+ service_impl_type service_impl_;
+};
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP

Modified: trunk/libs/asio/doc/overview/cpp2011.qbk
==============================================================================
--- trunk/libs/asio/doc/overview/cpp2011.qbk (original)
+++ trunk/libs/asio/doc/overview/cpp2011.qbk 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -20,6 +20,8 @@
 
 [link boost_asio.overview.cpp2011.shared_ptr Shared Pointers]
 
+[link boost_asio.overview.cpp2011.chrono Chrono]
+
 
 [section:move_objects Movable I/O Objects]
 
@@ -191,4 +193,27 @@
 
 [endsect]
 
+[section:chrono Chrono]
+
+Boost.Asio provides timers based on the `std::chrono` facilities via the [link
+boost_asio.reference.basic_waitable_timer basic_waitable_timer] class template.
+The typedefs [link boost_asio.reference.system_timer system_timer], [link
+boost_asio.reference.steady_timer steady_timer] and [link
+boost_asio.reference.high_resolution_timer high_resolution_timer] utilise the
+standard clocks `system_clock`, `steady_clock` and `high_resolution_clock`
+respectively.
+
+Support for the `std::chrono` facilities is automatically enabled for [^g++]
+4.6 and later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are
+used. (Note that, for [^g++], the draft-standard `monotonic_clock` is used in
+place of `steady_clock`.) Support may be disabled by defining
+`BOOST_ASIO_DISABLE_STD_CHRONO`, or explicitly enabled for other compilers by
+defining `BOOST_ASIO_HAS_STD_CHRONO`.
+
+When standard `chrono` is unavailable, Boost.Asio will otherwise use the Boost.Chrono
+library. The [link boost_asio.reference.basic_waitable_timer basic_waitable_timer]
+class template may be used with either.
+
+[endsect]
+
 [endsect]

Modified: trunk/libs/asio/test/Jamfile.v2
==============================================================================
--- trunk/libs/asio/test/Jamfile.v2 (original)
+++ trunk/libs/asio/test/Jamfile.v2 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -77,6 +77,8 @@
   [ link basic_stream_socket.cpp : $(USE_SELECT) : basic_stream_socket_select ]
   [ link basic_streambuf.cpp ]
   [ link basic_streambuf.cpp : $(USE_SELECT) : basic_streambuf_select ]
+ [ link basic_waitable_timer.cpp ]
+ [ link basic_waitable_timer.cpp : $(USE_SELECT) : basic_waitable_timer_select ]
   [ run buffer.cpp ]
   [ run buffer.cpp : : : $(USE_SELECT) : buffer_select ]
   [ run buffered_read_stream.cpp ]
@@ -99,6 +101,8 @@
   [ run deadline_timer.cpp : : : $(USE_SELECT) : deadline_timer_select ]
   [ run error.cpp ]
   [ run error.cpp : : : $(USE_SELECT) : error_select ]
+ [ link high_resolution_timer.cpp ]
+ [ link high_resolution_timer.cpp : $(USE_SELECT) : high_resolution_timer_select ]
   [ run io_service.cpp ]
   [ run io_service.cpp : : : $(USE_SELECT) : io_service_select ]
   [ link ip/address.cpp : : ip_address ]
@@ -175,14 +179,22 @@
   [ link socket_acceptor_service.cpp : $(USE_SELECT) : socket_acceptor_service_select ]
   [ run socket_base.cpp ]
   [ run socket_base.cpp : : : $(USE_SELECT) : socket_base_select ]
+ [ link steady_timer.cpp ]
+ [ link steady_timer.cpp : $(USE_SELECT) : steady_timer_select ]
   [ run strand.cpp ]
   [ run strand.cpp : : : $(USE_SELECT) : strand_select ]
   [ link stream_socket_service.cpp ]
   [ link stream_socket_service.cpp : $(USE_SELECT) : stream_socket_service_select ]
   [ run streambuf.cpp ]
   [ run streambuf.cpp : : : $(USE_SELECT) : streambuf_select ]
+ [ link system_timer.cpp ]
+ [ link system_timer.cpp : $(USE_SELECT) : system_timer_select ]
   [ link time_traits.cpp ]
   [ link time_traits.cpp : $(USE_SELECT) : time_traits_select ]
+ [ link wait_traits.cpp ]
+ [ link wait_traits.cpp : $(USE_SELECT) : wait_traits_select ]
+ [ link waitable_timer_service.cpp ]
+ [ link waitable_timer_service.cpp : $(USE_SELECT) : waitable_timer_service_select ]
   [ link windows/basic_handle.cpp : : windows_basic_handle ]
   [ link windows/basic_handle.cpp : $(USE_SELECT) : windows_basic_handle_select ]
   [ link windows/basic_random_access_handle.cpp : : windows_basic_random_access_handle ]

Added: trunk/libs/asio/test/basic_waitable_timer.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/asio/test/basic_waitable_timer.cpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,26 @@
+//
+// basic_waitable_timer.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/basic_waitable_timer.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("basic_waitable_timer");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Added: trunk/libs/asio/test/high_resolution_timer.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/asio/test/high_resolution_timer.cpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,31 @@
+//
+// high_resolution_timer.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Prevent link dependency on the Boost.System library.
+#if !defined(BOOST_SYSTEM_NO_DEPRECATED)
+#define BOOST_SYSTEM_NO_DEPRECATED
+#endif // !defined(BOOST_SYSTEM_NO_DEPRECATED)
+
+// Test that header file is self-contained.
+#include <boost/asio/high_resolution_timer.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("high_resolution_timer");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Added: trunk/libs/asio/test/steady_timer.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/asio/test/steady_timer.cpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,31 @@
+//
+// steady_timer.cpp
+// ~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Prevent link dependency on the Boost.System library.
+#if !defined(BOOST_SYSTEM_NO_DEPRECATED)
+#define BOOST_SYSTEM_NO_DEPRECATED
+#endif // !defined(BOOST_SYSTEM_NO_DEPRECATED)
+
+// Test that header file is self-contained.
+#include <boost/asio/steady_timer.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("steady_timer");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Added: trunk/libs/asio/test/system_timer.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/asio/test/system_timer.cpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,31 @@
+//
+// system_timer.cpp
+// ~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Prevent link dependency on the Boost.System library.
+#if !defined(BOOST_SYSTEM_NO_DEPRECATED)
+#define BOOST_SYSTEM_NO_DEPRECATED
+#endif // !defined(BOOST_SYSTEM_NO_DEPRECATED)
+
+// Test that header file is self-contained.
+#include <boost/asio/system_timer.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("system_timer");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Added: trunk/libs/asio/test/wait_traits.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/asio/test/wait_traits.cpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,26 @@
+//
+// wait_traits.cpp
+// ~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/wait_traits.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("wait_traits");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Added: trunk/libs/asio/test/waitable_timer_service.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/asio/test/waitable_timer_service.cpp 2012-01-09 08:43:38 EST (Mon, 09 Jan 2012)
@@ -0,0 +1,26 @@
+//
+// waitable_timer_service.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/waitable_timer_service.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("waitable_timer_service");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk