Fix up some I/O objects to use non-deprecated get_executor().
diff --git a/asio/include/asio/buffered_read_stream.hpp b/asio/include/asio/buffered_read_stream.hpp
index f58e4eb..daa6f59 100644
--- a/asio/include/asio/buffered_read_stream.hpp
+++ b/asio/include/asio/buffered_read_stream.hpp
@@ -55,6 +55,9 @@
/// 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;
+
#if defined(GENERATING_DOCUMENTATION)
/// The default buffer size.
static const std::size_t default_buffer_size = implementation_defined;
@@ -96,14 +99,21 @@
return next_layer_.lowest_layer();
}
- /// Get the io_context associated with the object.
+ /// Get the executor associated with the object.
+ executor_type get_executor() ASIO_NOEXCEPT
+ {
+ return next_layer_.lowest_layer().get_executor();
+ }
+
+#if !defined(ASIO_NO_DEPRECATED)
+ /// (Deprecated: Use get_executor().) Get the io_context associated with the
+ /// object.
asio::io_context& get_io_context()
{
return next_layer_.get_io_context();
}
-#if !defined(ASIO_NO_DEPRECATED)
- /// (Deprecated: Use get_io_context().) Get the io_context associated with the
+ /// (Deprecated: Use get_executor().) Get the io_context associated with the
/// object.
asio::io_context& get_io_service()
{
diff --git a/asio/include/asio/buffered_stream.hpp b/asio/include/asio/buffered_stream.hpp
index 0e84013..516e213 100644
--- a/asio/include/asio/buffered_stream.hpp
+++ b/asio/include/asio/buffered_stream.hpp
@@ -52,6 +52,9 @@
/// 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)
@@ -87,14 +90,21 @@
return stream_impl_.lowest_layer();
}
- /// Get the io_context associated with the object.
+ /// Get the executor associated with the object.
+ executor_type get_executor() ASIO_NOEXCEPT
+ {
+ return stream_impl_.lowest_layer().get_executor();
+ }
+
+#if !defined(ASIO_NO_DEPRECATED)
+ /// (Deprecated: Use get_executor().) Get the io_context associated with the
+ /// object.
asio::io_context& get_io_context()
{
return stream_impl_.get_io_context();
}
-#if !defined(ASIO_NO_DEPRECATED)
- /// (Deprecated: Use get_io_context().) Get the io_context associated with the
+ /// (Deprecated: Use get_executor().) Get the io_context associated with the
/// object.
asio::io_context& get_io_service()
{
diff --git a/asio/include/asio/buffered_write_stream.hpp b/asio/include/asio/buffered_write_stream.hpp
index 0b5ef89..0fa7547 100644
--- a/asio/include/asio/buffered_write_stream.hpp
+++ b/asio/include/asio/buffered_write_stream.hpp
@@ -55,6 +55,9 @@
/// 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;
+
#if defined(GENERATING_DOCUMENTATION)
/// The default buffer size.
static const std::size_t default_buffer_size = implementation_defined;
@@ -96,14 +99,21 @@
return next_layer_.lowest_layer();
}
- /// Get the io_context associated with the object.
+ /// Get the executor associated with the object.
+ executor_type get_executor() ASIO_NOEXCEPT
+ {
+ return next_layer_.lowest_layer().get_executor();
+ }
+
+#if !defined(ASIO_NO_DEPRECATED)
+ /// (Deprecated: Use get_executor().) Get the io_context associated with the
+ /// object.
asio::io_context& get_io_context()
{
return next_layer_.get_io_context();
}
-#if !defined(ASIO_NO_DEPRECATED)
- /// (Deprecated: Use get_io_context().) Get the io_context associated with the
+ /// (Deprecated: Use get_executor().) Get the io_context associated with the
/// object.
asio::io_context& get_io_service()
{
diff --git a/asio/include/asio/ssl/stream.hpp b/asio/include/asio/ssl/stream.hpp
index 207bba3..015066b 100644
--- a/asio/include/asio/ssl/stream.hpp
+++ b/asio/include/asio/ssl/stream.hpp
@@ -80,6 +80,9 @@
/// 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;
+
#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Construct a stream.
/**
@@ -112,19 +115,34 @@
{
}
- /// Get the io_context associated with the object.
+ /// Get the executor associated with the object.
/**
- * This function may be used to obtain the io_context object that the stream
+ * This function may be used to obtain the executor object that the stream
* uses to dispatch handlers for asynchronous operations.
*
- * @return A reference to the io_context object that stream will use to
- * dispatch handlers. Ownership is not transferred to the caller.
+ * @return A copy of the executor that stream will use to dispatch handlers.
*/
+ executor_type get_executor() ASIO_NOEXCEPT
+ {
+ return next_layer_.lowest_layer().get_executor();
+ }
+
+#if !defined(ASIO_NO_DEPRECATED)
+ /// (Deprecated: Use get_executor().) Get the io_context associated with the
+ /// object.
asio::io_context& get_io_context()
{
return next_layer_.lowest_layer().get_io_context();
}
+ /// (Deprecated: Use get_executor().) Get the io_context associated with the
+ /// object.
+ asio::io_context& get_io_service()
+ {
+ return next_layer_.lowest_layer().get_io_service();
+ }
+#endif // !defined(ASIO_NO_DEPRECATED)
+
/// Get the underlying implementation in the native type.
/**
* This function may be used to obtain the underlying implementation of the
diff --git a/asio/src/examples/cpp03/windows/transmit_file.cpp b/asio/src/examples/cpp03/windows/transmit_file.cpp
index 9ea2853..24502a0 100644
--- a/asio/src/examples/cpp03/windows/transmit_file.cpp
+++ b/asio/src/examples/cpp03/windows/transmit_file.cpp
@@ -28,7 +28,7 @@
random_access_handle& file, Handler handler)
{
// Construct an OVERLAPPED-derived object to contain the handler.
- overlapped_ptr overlapped(socket.get_io_context(), handler);
+ overlapped_ptr overlapped(socket.get_executor().context(), handler);
// Initiate the TransmitFile operation.
BOOL ok = ::TransmitFile(socket.native_handle(),
@@ -119,7 +119,7 @@
void start_accept()
{
connection::pointer new_connection =
- connection::create(acceptor_.get_io_context(), filename_);
+ connection::create(acceptor_.get_executor().context(), filename_);
acceptor_.async_accept(new_connection->socket(),
boost::bind(&server::handle_accept, this, new_connection,
diff --git a/asio/src/tests/unit/buffered_read_stream.cpp b/asio/src/tests/unit/buffered_read_stream.cpp
index 06047c2..b4cb4fd 100644
--- a/asio/src/tests/unit/buffered_read_stream.cpp
+++ b/asio/src/tests/unit/buffered_read_stream.cpp
@@ -78,9 +78,17 @@
stream_type stream1(ioc);
stream_type stream2(ioc, 1024);
+ stream_type::executor_type ex = stream1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = stream1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = stream1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
(void)lowest_layer;
diff --git a/asio/src/tests/unit/buffered_stream.cpp b/asio/src/tests/unit/buffered_stream.cpp
index a55a2a5..3d5f479 100644
--- a/asio/src/tests/unit/buffered_stream.cpp
+++ b/asio/src/tests/unit/buffered_stream.cpp
@@ -82,9 +82,17 @@
stream_type stream1(ioc);
stream_type stream2(ioc, 1024, 1024);
+ stream_type::executor_type ex = stream1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = stream1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = stream1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
(void)lowest_layer;
diff --git a/asio/src/tests/unit/buffered_write_stream.cpp b/asio/src/tests/unit/buffered_write_stream.cpp
index cf3a819..a9731e0 100644
--- a/asio/src/tests/unit/buffered_write_stream.cpp
+++ b/asio/src/tests/unit/buffered_write_stream.cpp
@@ -78,9 +78,17 @@
stream_type stream1(ioc);
stream_type stream2(ioc, 1024);
+ stream_type::executor_type ex = stream1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = stream1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = stream1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
(void)lowest_layer;
diff --git a/asio/src/tests/unit/generic/datagram_protocol.cpp b/asio/src/tests/unit/generic/datagram_protocol.cpp
index 58da16a..bb2c39b 100644
--- a/asio/src/tests/unit/generic/datagram_protocol.cpp
+++ b/asio/src/tests/unit/generic/datagram_protocol.cpp
@@ -94,9 +94,17 @@
// basic_io_object functions.
+ dp::socket::executor_type ex = socket1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = socket1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
// basic_socket functions.
dp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
diff --git a/asio/src/tests/unit/generic/raw_protocol.cpp b/asio/src/tests/unit/generic/raw_protocol.cpp
index 0ba8c11..b3d72f0 100644
--- a/asio/src/tests/unit/generic/raw_protocol.cpp
+++ b/asio/src/tests/unit/generic/raw_protocol.cpp
@@ -94,9 +94,17 @@
// basic_io_object functions.
+ rp::socket::executor_type ex = socket1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = socket1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
// basic_socket functions.
rp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
diff --git a/asio/src/tests/unit/generic/seq_packet_protocol.cpp b/asio/src/tests/unit/generic/seq_packet_protocol.cpp
index a2ba7be..da19165 100644
--- a/asio/src/tests/unit/generic/seq_packet_protocol.cpp
+++ b/asio/src/tests/unit/generic/seq_packet_protocol.cpp
@@ -90,9 +90,17 @@
// basic_io_object functions.
+ spp::socket::executor_type ex = socket1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = socket1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
// basic_socket functions.
spp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
diff --git a/asio/src/tests/unit/generic/stream_protocol.cpp b/asio/src/tests/unit/generic/stream_protocol.cpp
index 4a93f26..16711c5 100644
--- a/asio/src/tests/unit/generic/stream_protocol.cpp
+++ b/asio/src/tests/unit/generic/stream_protocol.cpp
@@ -104,9 +104,17 @@
// basic_io_object functions.
+ sp::socket::executor_type ex = socket1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = socket1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = socket1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
// basic_socket functions.
sp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
diff --git a/asio/src/tests/unit/is_read_buffered.cpp b/asio/src/tests/unit/is_read_buffered.cpp
index ee23478..f4ca5c9 100644
--- a/asio/src/tests/unit/is_read_buffered.cpp
+++ b/asio/src/tests/unit/is_read_buffered.cpp
@@ -31,6 +31,8 @@
typedef test_stream lowest_layer_type;
+ typedef io_context_type::executor_type executor_type;
+
test_stream(asio::io_context& io_context)
: io_context_(io_context)
{
diff --git a/asio/src/tests/unit/is_write_buffered.cpp b/asio/src/tests/unit/is_write_buffered.cpp
index 3b26c27..206a8a5 100644
--- a/asio/src/tests/unit/is_write_buffered.cpp
+++ b/asio/src/tests/unit/is_write_buffered.cpp
@@ -31,6 +31,8 @@
typedef test_stream lowest_layer_type;
+ typedef io_context_type::executor_type executor_type;
+
test_stream(asio::io_context& io_context)
: io_context_(io_context)
{
diff --git a/asio/src/tests/unit/serial_port.cpp b/asio/src/tests/unit/serial_port.cpp
index 6171afc..0a7f041 100644
--- a/asio/src/tests/unit/serial_port.cpp
+++ b/asio/src/tests/unit/serial_port.cpp
@@ -86,9 +86,17 @@
// basic_io_object functions.
+ serial_port::executor_type ex = port1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = port1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = port1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
// basic_serial_port functions.
serial_port::lowest_layer_type& lowest_layer = port1.lowest_layer();
diff --git a/asio/src/tests/unit/signal_set.cpp b/asio/src/tests/unit/signal_set.cpp
index c0356d2..88b983a 100644
--- a/asio/src/tests/unit/signal_set.cpp
+++ b/asio/src/tests/unit/signal_set.cpp
@@ -52,9 +52,17 @@
// basic_io_object functions.
+ signal_set::executor_type ex = set1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = set1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = set1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
// basic_signal_set functions.
set1.add(1);
diff --git a/asio/src/tests/unit/ssl/stream.cpp b/asio/src/tests/unit/ssl/stream.cpp
index 2020283..bac2c23 100644
--- a/asio/src/tests/unit/ssl/stream.cpp
+++ b/asio/src/tests/unit/ssl/stream.cpp
@@ -77,9 +77,17 @@
// basic_io_object functions.
+ ssl::stream<ip::tcp::socket>::executor_type ex = stream1.get_executor();
+ (void)ex;
+
+#if !defined(ASIO_NO_DEPRECATED)
io_context& ioc_ref = stream1.get_io_context();
(void)ioc_ref;
+ io_context& ioc_ref2 = stream1.get_io_service();
+ (void)ioc_ref2;
+#endif // !defined(ASIO_NO_DEPRECATED)
+
// ssl::stream functions.
SSL* ssl1 = stream1.native_handle();