Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2007-10-19 04:09:56


Author: chris_kohlhoff
Date: 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
New Revision: 40176
URL: http://svn.boost.org/trac/boost/changeset/40176

Log:
Add get_io_service() synonym for io_service() to match TR2 proposal.

Text files modified:
   trunk/boost/asio/basic_io_object.hpp | 18 ++++++++++++-
   trunk/boost/asio/basic_socket.hpp | 3 +
   trunk/boost/asio/buffered_read_stream.hpp | 17 +++++++++---
   trunk/boost/asio/buffered_stream.hpp | 11 +++++++-
   trunk/boost/asio/buffered_write_stream.hpp | 17 +++++++++---
   trunk/boost/asio/detail/deadline_timer_service.hpp | 2
   trunk/boost/asio/detail/reactive_socket_service.hpp | 50 +++++++++++++++++++-------------------
   trunk/boost/asio/detail/resolver_service.hpp | 4 +-
   trunk/boost/asio/detail/strand_service.hpp | 6 ++--
   trunk/boost/asio/detail/win_iocp_socket_service.hpp | 51 ++++++++++++++++++++-------------------
   trunk/boost/asio/impl/io_service.ipp | 10 +++++++
   trunk/boost/asio/io_service.hpp | 12 +++++++-
   trunk/boost/asio/ssl/detail/openssl_stream_service.hpp | 16 ++++++------
   trunk/boost/asio/ssl/stream.hpp | 20 +++++++++++++--
   trunk/boost/asio/strand.hpp | 18 ++++++++++++-
   trunk/libs/asio/example/services/basic_logger.hpp | 4 +-
   16 files changed, 171 insertions(+), 88 deletions(-)

Modified: trunk/boost/asio/basic_io_object.hpp
==============================================================================
--- trunk/boost/asio/basic_io_object.hpp (original)
+++ trunk/boost/asio/basic_io_object.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -35,7 +35,8 @@
   /// The underlying implementation type of I/O object.
   typedef typename service_type::implementation_type implementation_type;
 
- /// Get the io_service associated with the object.
+ /// [Deprecated: use get_io_service().] Get the io_service associated with
+ /// the object.
   /**
    * This function may be used to obtain the io_service object that the I/O
    * object uses to dispatch handlers for asynchronous operations.
@@ -45,7 +46,20 @@
    */
   boost::asio::io_service& io_service()
   {
- return service.io_service();
+ return service.get_io_service();
+ }
+
+ /// Get the io_service associated with the object.
+ /**
+ * This function may be used to obtain the io_service object that the I/O
+ * object uses to dispatch handlers for asynchronous operations.
+ *
+ * @return A reference to the io_service object that the I/O object will use
+ * to dispatch handlers. Ownership is not transferred to the caller.
+ */
+ boost::asio::io_service& get_io_service()
+ {
+ return service.get_io_service();
   }
 
 protected:

Modified: trunk/boost/asio/basic_socket.hpp
==============================================================================
--- trunk/boost/asio/basic_socket.hpp (original)
+++ trunk/boost/asio/basic_socket.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -565,7 +565,8 @@
       if (this->service.open(this->implementation,
             peer_endpoint.protocol(), ec))
       {
- this->io_service().post(boost::asio::detail::bind_handler(handler, ec));
+ this->get_io_service().post(
+ boost::asio::detail::bind_handler(handler, ec));
         return;
       }
     }

Modified: trunk/boost/asio/buffered_read_stream.hpp
==============================================================================
--- trunk/boost/asio/buffered_read_stream.hpp (original)
+++ trunk/boost/asio/buffered_read_stream.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -94,10 +94,17 @@
     return next_layer_.lowest_layer();
   }
 
- /// Get the io_service associated with the object.
+ /// [Deprecated: use get_io_service().] Get the io_service associated with
+ /// the object.
   boost::asio::io_service& io_service()
   {
- return next_layer_.io_service();
+ return next_layer_.get_io_service();
+ }
+
+ /// Get the io_service associated with the object.
+ boost::asio::io_service& get_io_service()
+ {
+ return next_layer_.get_io_service();
   }
 
   /// Close the stream.
@@ -208,7 +215,7 @@
         buffer(
           storage_.data() + previous_size,
           storage_.size() - previous_size),
- fill_handler<ReadHandler>(io_service(),
+ fill_handler<ReadHandler>(get_io_service(),
           storage_, previous_size, handler));
   }
 
@@ -296,12 +303,12 @@
     if (storage_.empty())
     {
       async_fill(read_some_handler<MutableBufferSequence, ReadHandler>(
- io_service(), storage_, buffers, handler));
+ get_io_service(), storage_, buffers, handler));
     }
     else
     {
       std::size_t length = copy(buffers);
- io_service().post(detail::bind_handler(
+ get_io_service().post(detail::bind_handler(
             handler, boost::system::error_code(), length));
     }
   }

Modified: trunk/boost/asio/buffered_stream.hpp
==============================================================================
--- trunk/boost/asio/buffered_stream.hpp (original)
+++ trunk/boost/asio/buffered_stream.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -84,10 +84,17 @@
     return stream_impl_.lowest_layer();
   }
 
- /// Get the io_service associated with the object.
+ /// [Deprecated: use get_io_service().] Get the io_service associated with
+ /// the object.
   boost::asio::io_service& io_service()
   {
- return stream_impl_.io_service();
+ return stream_impl_.get_io_service();
+ }
+
+ /// Get the io_service associated with the object.
+ boost::asio::io_service& get_io_service()
+ {
+ return stream_impl_.get_io_service();
   }
 
   /// Close the stream.

Modified: trunk/boost/asio/buffered_write_stream.hpp
==============================================================================
--- trunk/boost/asio/buffered_write_stream.hpp (original)
+++ trunk/boost/asio/buffered_write_stream.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -95,10 +95,17 @@
     return next_layer_.lowest_layer();
   }
 
- /// Get the io_service associated with the object.
+ /// [Deprecated: use get_io_service().] Get the io_service associated with
+ /// the object.
   boost::asio::io_service& io_service()
   {
- return next_layer_.io_service();
+ return next_layer_.get_io_service();
+ }
+
+ /// Get the io_service associated with the object.
+ boost::asio::io_service& get_io_service()
+ {
+ return next_layer_.get_io_service();
   }
 
   /// Close the stream.
@@ -166,7 +173,7 @@
   void async_flush(WriteHandler handler)
   {
     async_write(next_layer_, buffer(storage_.data(), storage_.size()),
- flush_handler<WriteHandler>(io_service(), storage_, handler));
+ flush_handler<WriteHandler>(get_io_service(), storage_, handler));
   }
 
   /// Write the given data to the stream. Returns the number of bytes written.
@@ -254,12 +261,12 @@
     if (storage_.size() == storage_.capacity())
     {
       async_flush(write_some_handler<ConstBufferSequence, WriteHandler>(
- io_service(), storage_, buffers, handler));
+ get_io_service(), storage_, buffers, handler));
     }
     else
     {
       std::size_t bytes_copied = copy(buffers);
- io_service().post(detail::bind_handler(
+ get_io_service().post(detail::bind_handler(
             handler, boost::system::error_code(), bytes_copied));
     }
   }

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 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -181,7 +181,7 @@
   {
     impl.might_have_pending_waits = true;
     scheduler_.schedule_timer(timer_queue_, impl.expiry,
- wait_handler<Handler>(this->io_service(), handler), &impl);
+ wait_handler<Handler>(this->get_io_service(), handler), &impl);
   }
 
 private:

Modified: trunk/boost/asio/detail/reactive_socket_service.hpp
==============================================================================
--- trunk/boost/asio/detail/reactive_socket_service.hpp (original)
+++ trunk/boost/asio/detail/reactive_socket_service.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -625,7 +625,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor, 0));
     }
     else
@@ -646,7 +646,7 @@
         // A request to receive 0 bytes on a stream socket is a no-op.
         if (total_buffer_size == 0)
         {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
                 boost::system::error_code(), 0));
           return;
         }
@@ -659,7 +659,7 @@
         boost::system::error_code ec;
         if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
         {
- this->io_service().post(bind_handler(handler, ec, 0));
+ this->get_io_service().post(bind_handler(handler, ec, 0));
           return;
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
@@ -667,7 +667,7 @@
 
       reactor_.start_write_op(impl.socket_,
           send_handler<ConstBufferSequence, Handler>(
- impl.socket_, this->io_service(), buffers, flags, handler));
+ impl.socket_, this->get_io_service(), buffers, flags, handler));
     }
   }
 
@@ -805,7 +805,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor, 0));
     }
     else
@@ -817,7 +817,7 @@
         boost::system::error_code ec;
         if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
         {
- this->io_service().post(bind_handler(handler, ec, 0));
+ this->get_io_service().post(bind_handler(handler, ec, 0));
           return;
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
@@ -825,7 +825,7 @@
 
       reactor_.start_write_op(impl.socket_,
           send_to_handler<ConstBufferSequence, Handler>(
- impl.socket_, this->io_service(), buffers,
+ impl.socket_, this->get_io_service(), buffers,
             destination, flags, handler));
     }
   }
@@ -976,7 +976,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor, 0));
     }
     else
@@ -997,7 +997,7 @@
         // A request to receive 0 bytes on a stream socket is a no-op.
         if (total_buffer_size == 0)
         {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
                 boost::system::error_code(), 0));
           return;
         }
@@ -1010,7 +1010,7 @@
         boost::system::error_code ec;
         if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
         {
- this->io_service().post(bind_handler(handler, ec, 0));
+ this->get_io_service().post(bind_handler(handler, ec, 0));
           return;
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
@@ -1020,13 +1020,13 @@
       {
         reactor_.start_except_op(impl.socket_,
             receive_handler<MutableBufferSequence, Handler>(
- impl.socket_, this->io_service(), buffers, flags, handler));
+ impl.socket_, this->get_io_service(), buffers, flags, handler));
       }
       else
       {
         reactor_.start_read_op(impl.socket_,
             receive_handler<MutableBufferSequence, Handler>(
- impl.socket_, this->io_service(), buffers, flags, handler));
+ impl.socket_, this->get_io_service(), buffers, flags, handler));
       }
     }
   }
@@ -1182,7 +1182,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor, 0));
     }
     else
@@ -1194,7 +1194,7 @@
         boost::system::error_code ec;
         if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
         {
- this->io_service().post(bind_handler(handler, ec, 0));
+ this->get_io_service().post(bind_handler(handler, ec, 0));
           return;
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
@@ -1202,7 +1202,7 @@
 
       reactor_.start_read_op(impl.socket_,
           receive_from_handler<MutableBufferSequence, Handler>(
- impl.socket_, this->io_service(), buffers,
+ impl.socket_, this->get_io_service(), buffers,
             sender_endpoint, flags, handler));
     }
   }
@@ -1385,12 +1385,12 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor));
     }
     else if (peer.is_open())
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::already_open));
     }
     else
@@ -1402,7 +1402,7 @@
         boost::system::error_code ec;
         if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
         {
- this->io_service().post(bind_handler(handler, ec));
+ this->get_io_service().post(bind_handler(handler, ec));
           return;
         }
         impl.flags_ |= implementation_type::internal_non_blocking;
@@ -1410,7 +1410,7 @@
 
       reactor_.start_read_op(impl.socket_,
           accept_handler<Socket, Handler>(
- impl.socket_, this->io_service(),
+ impl.socket_, this->get_io_service(),
             peer, impl.protocol_, peer_endpoint,
             (impl.flags_ & implementation_type::enable_connection_aborted) != 0,
             handler));
@@ -1516,7 +1516,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor));
       return;
     }
@@ -1528,7 +1528,7 @@
       boost::system::error_code ec;
       if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
       {
- this->io_service().post(bind_handler(handler, ec));
+ this->get_io_service().post(bind_handler(handler, ec));
         return;
       }
       impl.flags_ |= implementation_type::internal_non_blocking;
@@ -1542,7 +1542,7 @@
     {
       // The connect operation has finished successfully so we need to post the
       // handler immediately.
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::system::error_code()));
     }
     else if (ec == boost::asio::error::in_progress
@@ -1552,13 +1552,13 @@
       // until the socket becomes writeable.
       boost::shared_ptr<bool> completed(new bool(false));
       reactor_.start_write_and_except_ops(impl.socket_,
- connect_handler<Handler>(
- impl.socket_, completed, this->io_service(), reactor_, handler));
+ connect_handler<Handler>(impl.socket_, completed,
+ this->get_io_service(), reactor_, handler));
     }
     else
     {
       // The connect operation has failed, so post the handler immediately.
- this->io_service().post(bind_handler(handler, ec));
+ this->get_io_service().post(bind_handler(handler, ec));
     }
   }
 

Modified: trunk/boost/asio/detail/resolver_service.hpp
==============================================================================
--- trunk/boost/asio/detail/resolver_service.hpp (original)
+++ trunk/boost/asio/detail/resolver_service.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -214,7 +214,7 @@
       start_work_thread();
       work_io_service_->post(
           resolve_query_handler<Handler>(
- impl, query, this->io_service(), handler));
+ impl, query, this->get_io_service(), handler));
     }
   }
 
@@ -310,7 +310,7 @@
       start_work_thread();
       work_io_service_->post(
           resolve_endpoint_handler<Handler>(
- impl, endpoint, this->io_service(), handler));
+ impl, endpoint, this->get_io_service(), handler));
     }
   }
 

Modified: trunk/boost/asio/detail/strand_service.hpp
==============================================================================
--- trunk/boost/asio/detail/strand_service.hpp (original)
+++ trunk/boost/asio/detail/strand_service.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -277,7 +277,7 @@
           if (impl_->first_waiter_ == 0)
             impl_->last_waiter_ = 0;
           lock.unlock();
- service_impl_.io_service().post(
+ service_impl_.get_io_service().post(
               invoke_current_handler(service_impl_, impl_));
         }
       }
@@ -430,7 +430,7 @@
         // This handler now has the lock, so can be dispatched immediately.
         impl->current_handler_ = ptr.get();
         lock.unlock();
- this->io_service().dispatch(invoke_current_handler(*this, impl));
+ this->get_io_service().dispatch(invoke_current_handler(*this, impl));
         ptr.release();
       }
       else
@@ -470,7 +470,7 @@
       // This handler now has the lock, so can be dispatched immediately.
       impl->current_handler_ = ptr.get();
       lock.unlock();
- this->io_service().post(invoke_current_handler(*this, impl));
+ this->get_io_service().post(invoke_current_handler(*this, impl));
       ptr.release();
     }
     else

Modified: trunk/boost/asio/detail/win_iocp_socket_service.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_socket_service.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_socket_service.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -768,7 +768,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor, 0));
       return;
     }
@@ -784,7 +784,7 @@
     typedef handler_alloc_traits<Handler, value_type> alloc_traits;
     raw_handler_ptr<alloc_traits> raw_ptr(handler);
     handler_ptr<alloc_traits> ptr(raw_ptr,
- this->io_service(), impl.cancel_token_, buffers, handler);
+ this->get_io_service(), impl.cancel_token_, buffers, handler);
 
     // Copy buffers into WSABUF array.
     ::WSABUF bufs[max_buffers];
@@ -804,7 +804,7 @@
     // A request to receive 0 bytes on a stream socket is a no-op.
     if (impl.protocol_.type() == SOCK_STREAM && total_buffer_size == 0)
     {
- boost::asio::io_service::work work(this->io_service());
+ boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code error;
       iocp_service_.post(bind_handler(handler, error, 0));
@@ -820,7 +820,7 @@
     // Check if the operation completed immediately.
     if (result != 0 && last_error != WSA_IO_PENDING)
     {
- boost::asio::io_service::work work(this->io_service());
+ boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code ec(last_error,
           boost::asio::error::system_category);
@@ -959,7 +959,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor, 0));
       return;
     }
@@ -975,7 +975,7 @@
     typedef handler_alloc_traits<Handler, value_type> alloc_traits;
     raw_handler_ptr<alloc_traits> raw_ptr(handler);
     handler_ptr<alloc_traits> ptr(raw_ptr,
- this->io_service(), buffers, handler);
+ this->get_io_service(), buffers, handler);
 
     // Copy buffers into WSABUF array.
     ::WSABUF bufs[max_buffers];
@@ -999,7 +999,7 @@
     // Check if the operation completed immediately.
     if (result != 0 && last_error != WSA_IO_PENDING)
     {
- boost::asio::io_service::work work(this->io_service());
+ boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code ec(last_error,
           boost::asio::error::system_category);
@@ -1171,7 +1171,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor, 0));
       return;
     }
@@ -1187,7 +1187,7 @@
     typedef handler_alloc_traits<Handler, value_type> alloc_traits;
     raw_handler_ptr<alloc_traits> raw_ptr(handler);
     handler_ptr<alloc_traits> ptr(raw_ptr,
- this->io_service(), impl.cancel_token_, buffers, handler);
+ this->get_io_service(), impl.cancel_token_, buffers, handler);
 
     // Copy buffers into WSABUF array.
     ::WSABUF bufs[max_buffers];
@@ -1206,7 +1206,7 @@
     // A request to receive 0 bytes on a stream socket is a no-op.
     if (impl.protocol_.type() == SOCK_STREAM && total_buffer_size == 0)
     {
- boost::asio::io_service::work work(this->io_service());
+ boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code error;
       iocp_service_.post(bind_handler(handler, error, 0));
@@ -1221,7 +1221,7 @@
     DWORD last_error = ::WSAGetLastError();
     if (result != 0 && last_error != WSA_IO_PENDING)
     {
- boost::asio::io_service::work work(this->io_service());
+ boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code ec(last_error,
           boost::asio::error::system_category);
@@ -1391,7 +1391,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor, 0));
       return;
     }
@@ -1407,7 +1407,7 @@
     typedef handler_alloc_traits<Handler, value_type> alloc_traits;
     raw_handler_ptr<alloc_traits> raw_ptr(handler);
     handler_ptr<alloc_traits> ptr(raw_ptr,
- this->io_service(), sender_endp, buffers, handler);
+ this->get_io_service(), sender_endp, buffers, handler);
 
     // Copy buffers into WSABUF array.
     ::WSABUF bufs[max_buffers];
@@ -1430,7 +1430,7 @@
     DWORD last_error = ::WSAGetLastError();
     if (result != 0 && last_error != WSA_IO_PENDING)
     {
- boost::asio::io_service::work work(this->io_service());
+ boost::asio::io_service::work work(this->get_io_service());
       ptr.reset();
       boost::system::error_code ec(last_error,
           boost::asio::error::system_category);
@@ -1518,7 +1518,7 @@
         peer_(peer),
         protocol_(protocol),
         peer_endpoint_(peer_endpoint),
- work_(io_service.io_service()),
+ work_(io_service.get_io_service()),
         enable_connection_aborted_(enable_connection_aborted),
         handler_(handler)
     {
@@ -1707,7 +1707,7 @@
     // Check whether acceptor has been initialised.
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor));
       return;
     }
@@ -1715,7 +1715,7 @@
     // Check that peer socket has not already been opened.
     if (peer.is_open())
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::already_open));
       return;
     }
@@ -1732,7 +1732,7 @@
           impl.protocol_.type(), impl.protocol_.protocol(), ec));
     if (sock.get() == invalid_socket)
     {
- this->io_service().post(bind_handler(handler, ec));
+ this->get_io_service().post(bind_handler(handler, ec));
       return;
     }
 
@@ -1770,7 +1770,7 @@
       }
       else
       {
- boost::asio::io_service::work work(this->io_service());
+ boost::asio::io_service::work work(this->get_io_service());
         ptr.reset();
         boost::system::error_code ec(last_error,
             boost::asio::error::system_category);
@@ -1889,7 +1889,7 @@
   {
     if (!is_open(impl))
     {
- this->io_service().post(bind_handler(handler,
+ this->get_io_service().post(bind_handler(handler,
             boost::asio::error::bad_descriptor));
       return;
     }
@@ -1906,7 +1906,8 @@
             reinterpret_cast<void**>(&reactor_), 0, 0));
     if (!reactor)
     {
- reactor = &(boost::asio::use_service<reactor_type>(this->io_service()));
+ reactor = &(boost::asio::use_service<reactor_type>(
+ this->get_io_service()));
       interlocked_exchange_pointer(
           reinterpret_cast<void**>(&reactor_), reactor);
     }
@@ -1917,7 +1918,7 @@
     boost::system::error_code ec;
     if (socket_ops::ioctl(impl.socket_, FIONBIO, &non_blocking, ec))
     {
- this->io_service().post(bind_handler(handler, ec));
+ this->get_io_service().post(bind_handler(handler, ec));
       return;
     }
 
@@ -1934,7 +1935,7 @@
 
       // The connect operation has finished successfully so we need to post the
       // handler immediately.
- this->io_service().post(bind_handler(handler, ec));
+ this->get_io_service().post(bind_handler(handler, ec));
     }
     else if (ec == boost::asio::error::in_progress
         || ec == boost::asio::error::would_block)
@@ -1946,7 +1947,7 @@
           connect_handler<Handler>(
             impl.socket_,
             (impl.flags_ & implementation_type::user_set_non_blocking) != 0,
- completed, this->io_service(), *reactor, handler));
+ completed, this->get_io_service(), *reactor, handler));
     }
     else
     {
@@ -1959,7 +1960,7 @@
       }
 
       // The connect operation has failed, so post the handler immediately.
- this->io_service().post(bind_handler(handler, ec));
+ this->get_io_service().post(bind_handler(handler, ec));
     }
   }
 

Modified: trunk/boost/asio/impl/io_service.ipp
==============================================================================
--- trunk/boost/asio/impl/io_service.ipp (original)
+++ trunk/boost/asio/impl/io_service.ipp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -159,6 +159,11 @@
   return io_service_;
 }
 
+inline boost::asio::io_service& io_service::work::get_io_service()
+{
+ return io_service_;
+}
+
 inline io_service::service::service(boost::asio::io_service& owner)
   : owner_(owner),
     type_info_(0),
@@ -175,6 +180,11 @@
   return owner_;
 }
 
+inline boost::asio::io_service& io_service::service::get_io_service()
+{
+ return owner_;
+}
+
 template <typename Service>
 inline Service& use_service(io_service& ios)
 {

Modified: trunk/boost/asio/io_service.hpp
==============================================================================
--- trunk/boost/asio/io_service.hpp (original)
+++ trunk/boost/asio/io_service.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -431,9 +431,13 @@
    */
   ~work();
 
- /// Get the io_service associated with the work.
+ /// [Deprecated: use get_io_service().] Get the io_service associated with the
+ /// work.
   boost::asio::io_service& io_service();
 
+ /// Get the io_service associated with the work.
+ boost::asio::io_service& get_io_service();
+
 private:
   // Prevent assignment.
   void operator=(const work& other);
@@ -456,9 +460,13 @@
   : private noncopyable
 {
 public:
- /// Get the io_service object that owns the service.
+ /// [Deprecated: use get_io_service().] Get the io_service object that owns
+ /// the service.
   boost::asio::io_service& io_service();
 
+ /// Get the io_service object that owns the service.
+ boost::asio::io_service& get_io_service();
+
 protected:
   /// Constructor.
   /**

Modified: trunk/boost/asio/ssl/detail/openssl_stream_service.hpp
==============================================================================
--- trunk/boost/asio/ssl/detail/openssl_stream_service.hpp (original)
+++ trunk/boost/asio/ssl/detail/openssl_stream_service.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -239,7 +239,7 @@
     typedef handshake_handler<Stream, Handler> connect_handler;
 
     connect_handler* local_handler =
- new connect_handler(handler, io_service());
+ new connect_handler(handler, get_io_service());
 
     openssl_operation<Stream>* op = new openssl_operation<Stream>
     (
@@ -260,7 +260,7 @@
     );
     local_handler->set_operation(op);
 
- io_service().post(boost::bind(&openssl_operation<Stream>::start, op));
+ get_io_service().post(boost::bind(&openssl_operation<Stream>::start, op));
   }
 
   // Shut down SSL on the stream.
@@ -295,7 +295,7 @@
     typedef shutdown_handler<Stream, Handler> disconnect_handler;
 
     disconnect_handler* local_handler =
- new disconnect_handler(handler, io_service());
+ new disconnect_handler(handler, get_io_service());
 
     openssl_operation<Stream>* op = new openssl_operation<Stream>
     (
@@ -314,7 +314,7 @@
     );
     local_handler->set_operation(op);
 
- io_service().post(boost::bind(&openssl_operation<Stream>::start, op));
+ get_io_service().post(boost::bind(&openssl_operation<Stream>::start, op));
   }
 
   // Write some data to the stream.
@@ -355,7 +355,7 @@
   {
     typedef io_handler<Stream, Handler> send_handler;
 
- send_handler* local_handler = new send_handler(handler, io_service());
+ send_handler* local_handler = new send_handler(handler, get_io_service());
 
     boost::function<int (SSL*)> send_func =
       boost::bind(&::SSL_write, boost::arg<1>(),
@@ -379,7 +379,7 @@
     );
     local_handler->set_operation(op);
 
- io_service().post(boost::bind(&openssl_operation<Stream>::start, op));
+ get_io_service().post(boost::bind(&openssl_operation<Stream>::start, op));
   }
 
   // Read some data from the stream.
@@ -420,7 +420,7 @@
   {
     typedef io_handler<Stream, Handler> recv_handler;
 
- recv_handler* local_handler = new recv_handler(handler, io_service());
+ recv_handler* local_handler = new recv_handler(handler, get_io_service());
 
     boost::function<int (SSL*)> recv_func =
       boost::bind(&::SSL_read, boost::arg<1>(),
@@ -444,7 +444,7 @@
     );
     local_handler->set_operation(op);
 
- io_service().post(boost::bind(&openssl_operation<Stream>::start, op));
+ get_io_service().post(boost::bind(&openssl_operation<Stream>::start, op));
   }
 
   // Peek at the incoming data on the stream.

Modified: trunk/boost/asio/ssl/stream.hpp
==============================================================================
--- trunk/boost/asio/ssl/stream.hpp (original)
+++ trunk/boost/asio/ssl/stream.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -86,7 +86,7 @@
   template <typename Arg, typename Context_Service>
   explicit stream(Arg& arg, basic_context<Context_Service>& context)
     : next_layer_(arg),
- service_(boost::asio::use_service<Service>(next_layer_.io_service())),
+ service_(boost::asio::use_service<Service>(next_layer_.get_io_service())),
       impl_(service_.null())
   {
     service_.create(impl_, next_layer_, context);
@@ -98,7 +98,8 @@
     service_.destroy(impl_, next_layer_);
   }
 
- /// Get the io_service associated with the object.
+ /// [Deprecated: use get_io_service().] Get the io_service associated with
+ /// the object.
   /**
    * This function may be used to obtain the io_service object that the stream
    * uses to dispatch handlers for asynchronous operations.
@@ -108,7 +109,20 @@
    */
   boost::asio::io_service& io_service()
   {
- return next_layer_.io_service();
+ return next_layer_.get_io_service();
+ }
+
+ /// Get the io_service associated with the object.
+ /**
+ * This function may be used to obtain the io_service object that the stream
+ * uses to dispatch handlers for asynchronous operations.
+ *
+ * @return A reference to the io_service object that stream will use to
+ * dispatch handlers. Ownership is not transferred to the caller.
+ */
+ boost::asio::io_service& get_io_service()
+ {
+ return next_layer_.get_io_service();
   }
 
   /// Get a reference to the next layer.

Modified: trunk/boost/asio/strand.hpp
==============================================================================
--- trunk/boost/asio/strand.hpp (original)
+++ trunk/boost/asio/strand.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -66,7 +66,8 @@
     service_.destroy(impl_);
   }
 
- /// Get the io_service associated with the strand.
+ /// [Deprecated: use get_io_service().] Get the io_service associated with
+ /// the strand.
   /**
    * This function may be used to obtain the io_service object that the strand
    * uses to dispatch handlers for asynchronous operations.
@@ -76,7 +77,20 @@
    */
   boost::asio::io_service& io_service()
   {
- return service_.io_service();
+ return service_.get_io_service();
+ }
+
+ /// Get the io_service associated with the strand.
+ /**
+ * This function may be used to obtain the io_service object that the strand
+ * uses to dispatch handlers for asynchronous operations.
+ *
+ * @return A reference to the io_service object that the strand will use to
+ * dispatch handlers. Ownership is not transferred to the caller.
+ */
+ boost::asio::io_service& get_io_service()
+ {
+ return service_.get_io_service();
   }
 
   /// Request the strand to invoke the given handler.

Modified: trunk/libs/asio/example/services/basic_logger.hpp
==============================================================================
--- trunk/libs/asio/example/services/basic_logger.hpp (original)
+++ trunk/libs/asio/example/services/basic_logger.hpp 2007-10-19 04:09:55 EDT (Fri, 19 Oct 2007)
@@ -53,9 +53,9 @@
   }
 
   /// Get the io_service associated with the object.
- boost::asio::io_service& io_service()
+ boost::asio::io_service& get_io_service()
   {
- return service_.io_service();
+ return service_.get_io_service();
   }
 
   /// Set the output file for all logger instances.


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