diff options
Diffstat (limited to 'boost/asio/buffered_stream.hpp')
-rw-r--r-- | boost/asio/buffered_stream.hpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/boost/asio/buffered_stream.hpp b/boost/asio/buffered_stream.hpp index fae7c27113..a468370ffe 100644 --- a/boost/asio/buffered_stream.hpp +++ b/boost/asio/buffered_stream.hpp @@ -23,7 +23,7 @@ #include <boost/asio/buffered_stream_fwd.hpp> #include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/error.hpp> -#include <boost/asio/io_service.hpp> +#include <boost/asio/io_context.hpp> #include <boost/asio/detail/push_options.hpp> @@ -53,6 +53,9 @@ public: /// The type of the lowest layer. typedef typename next_layer_type::lowest_layer_type lowest_layer_type; + /// The type of the executor associated with the object. + typedef typename lowest_layer_type::executor_type executor_type; + /// Construct, passing the specified argument to initialise the next layer. template <typename Arg> explicit buffered_stream(Arg& a) @@ -88,11 +91,27 @@ public: return stream_impl_.lowest_layer(); } - /// Get the io_service associated with the object. - boost::asio::io_service& get_io_service() + /// Get the executor associated with the object. + executor_type get_executor() BOOST_ASIO_NOEXCEPT + { + return stream_impl_.lowest_layer().get_executor(); + } + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + /// (Deprecated: Use get_executor().) Get the io_context associated with the + /// object. + boost::asio::io_context& get_io_context() + { + return stream_impl_.get_io_context(); + } + + /// (Deprecated: Use get_executor().) Get the io_context associated with the + /// object. + boost::asio::io_context& get_io_service() { return stream_impl_.get_io_service(); } +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Close the stream. void close() @@ -101,9 +120,10 @@ public: } /// Close the stream. - boost::system::error_code close(boost::system::error_code& ec) + BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec) { - return stream_impl_.close(ec); + stream_impl_.close(ec); + BOOST_ASIO_SYNC_OP_VOID_RETURN(ec); } /// Flush all data from the buffer to the next layer. Returns the number of |