Fix up some I/O objects to use non-deprecated get_executor().
This commit is contained in:
parent
f1ebd9522f
commit
24c6d7e3c7
@ -55,6 +55,9 @@ public:
|
|||||||
/// The type of the lowest layer.
|
/// The type of the lowest layer.
|
||||||
typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
|
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)
|
#if defined(GENERATING_DOCUMENTATION)
|
||||||
/// The default buffer size.
|
/// The default buffer size.
|
||||||
static const std::size_t default_buffer_size = implementation_defined;
|
static const std::size_t default_buffer_size = implementation_defined;
|
||||||
@ -96,14 +99,21 @@ public:
|
|||||||
return next_layer_.lowest_layer();
|
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()
|
asio::io_context& get_io_context()
|
||||||
{
|
{
|
||||||
return next_layer_.get_io_context();
|
return next_layer_.get_io_context();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(ASIO_NO_DEPRECATED)
|
/// (Deprecated: Use get_executor().) Get the io_context associated with the
|
||||||
/// (Deprecated: Use get_io_context().) Get the io_context associated with the
|
|
||||||
/// object.
|
/// object.
|
||||||
asio::io_context& get_io_service()
|
asio::io_context& get_io_service()
|
||||||
{
|
{
|
||||||
|
@ -52,6 +52,9 @@ public:
|
|||||||
/// The type of the lowest layer.
|
/// The type of the lowest layer.
|
||||||
typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
|
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.
|
/// Construct, passing the specified argument to initialise the next layer.
|
||||||
template <typename Arg>
|
template <typename Arg>
|
||||||
explicit buffered_stream(Arg& a)
|
explicit buffered_stream(Arg& a)
|
||||||
@ -87,14 +90,21 @@ public:
|
|||||||
return stream_impl_.lowest_layer();
|
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()
|
asio::io_context& get_io_context()
|
||||||
{
|
{
|
||||||
return stream_impl_.get_io_context();
|
return stream_impl_.get_io_context();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(ASIO_NO_DEPRECATED)
|
/// (Deprecated: Use get_executor().) Get the io_context associated with the
|
||||||
/// (Deprecated: Use get_io_context().) Get the io_context associated with the
|
|
||||||
/// object.
|
/// object.
|
||||||
asio::io_context& get_io_service()
|
asio::io_context& get_io_service()
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,9 @@ public:
|
|||||||
/// The type of the lowest layer.
|
/// The type of the lowest layer.
|
||||||
typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
|
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)
|
#if defined(GENERATING_DOCUMENTATION)
|
||||||
/// The default buffer size.
|
/// The default buffer size.
|
||||||
static const std::size_t default_buffer_size = implementation_defined;
|
static const std::size_t default_buffer_size = implementation_defined;
|
||||||
@ -96,14 +99,21 @@ public:
|
|||||||
return next_layer_.lowest_layer();
|
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()
|
asio::io_context& get_io_context()
|
||||||
{
|
{
|
||||||
return next_layer_.get_io_context();
|
return next_layer_.get_io_context();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(ASIO_NO_DEPRECATED)
|
/// (Deprecated: Use get_executor().) Get the io_context associated with the
|
||||||
/// (Deprecated: Use get_io_context().) Get the io_context associated with the
|
|
||||||
/// object.
|
/// object.
|
||||||
asio::io_context& get_io_service()
|
asio::io_context& get_io_service()
|
||||||
{
|
{
|
||||||
|
@ -80,6 +80,9 @@ public:
|
|||||||
/// The type of the lowest layer.
|
/// The type of the lowest layer.
|
||||||
typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
|
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)
|
#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
|
||||||
/// Construct a stream.
|
/// Construct a stream.
|
||||||
/**
|
/**
|
||||||
@ -112,19 +115,34 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
* uses to dispatch handlers for asynchronous operations.
|
||||||
*
|
*
|
||||||
* @return A reference to the io_context object that stream will use to
|
* @return A copy of the executor that stream will use to dispatch handlers.
|
||||||
* dispatch handlers. Ownership is not transferred to the caller.
|
|
||||||
*/
|
*/
|
||||||
|
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()
|
asio::io_context& get_io_context()
|
||||||
{
|
{
|
||||||
return next_layer_.lowest_layer().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.
|
/// Get the underlying implementation in the native type.
|
||||||
/**
|
/**
|
||||||
* This function may be used to obtain the underlying implementation of the
|
* This function may be used to obtain the underlying implementation of the
|
||||||
|
@ -28,7 +28,7 @@ void transmit_file(tcp::socket& socket,
|
|||||||
random_access_handle& file, Handler handler)
|
random_access_handle& file, Handler handler)
|
||||||
{
|
{
|
||||||
// Construct an OVERLAPPED-derived object to contain the 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.
|
// Initiate the TransmitFile operation.
|
||||||
BOOL ok = ::TransmitFile(socket.native_handle(),
|
BOOL ok = ::TransmitFile(socket.native_handle(),
|
||||||
@ -119,7 +119,7 @@ private:
|
|||||||
void start_accept()
|
void start_accept()
|
||||||
{
|
{
|
||||||
connection::pointer new_connection =
|
connection::pointer new_connection =
|
||||||
connection::create(acceptor_.get_io_context(), filename_);
|
connection::create(acceptor_.get_executor().context(), filename_);
|
||||||
|
|
||||||
acceptor_.async_accept(new_connection->socket(),
|
acceptor_.async_accept(new_connection->socket(),
|
||||||
boost::bind(&server::handle_accept, this, new_connection,
|
boost::bind(&server::handle_accept, this, new_connection,
|
||||||
|
@ -78,9 +78,17 @@ void test_compile()
|
|||||||
stream_type stream1(ioc);
|
stream_type stream1(ioc);
|
||||||
stream_type stream2(ioc, 1024);
|
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();
|
io_context& ioc_ref = stream1.get_io_context();
|
||||||
(void)ioc_ref;
|
(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();
|
stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
|
||||||
(void)lowest_layer;
|
(void)lowest_layer;
|
||||||
|
|
||||||
|
@ -82,9 +82,17 @@ void test_compile()
|
|||||||
stream_type stream1(ioc);
|
stream_type stream1(ioc);
|
||||||
stream_type stream2(ioc, 1024, 1024);
|
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();
|
io_context& ioc_ref = stream1.get_io_context();
|
||||||
(void)ioc_ref;
|
(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();
|
stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
|
||||||
(void)lowest_layer;
|
(void)lowest_layer;
|
||||||
|
|
||||||
|
@ -78,9 +78,17 @@ void test_compile()
|
|||||||
stream_type stream1(ioc);
|
stream_type stream1(ioc);
|
||||||
stream_type stream2(ioc, 1024);
|
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();
|
io_context& ioc_ref = stream1.get_io_context();
|
||||||
(void)ioc_ref;
|
(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();
|
stream_type::lowest_layer_type& lowest_layer = stream1.lowest_layer();
|
||||||
(void)lowest_layer;
|
(void)lowest_layer;
|
||||||
|
|
||||||
|
@ -94,9 +94,17 @@ void test()
|
|||||||
|
|
||||||
// basic_io_object functions.
|
// 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();
|
io_context& ioc_ref = socket1.get_io_context();
|
||||||
(void)ioc_ref;
|
(void)ioc_ref;
|
||||||
|
|
||||||
|
io_context& ioc_ref2 = socket1.get_io_service();
|
||||||
|
(void)ioc_ref2;
|
||||||
|
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||||
|
|
||||||
// basic_socket functions.
|
// basic_socket functions.
|
||||||
|
|
||||||
dp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
|
dp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
|
||||||
|
@ -94,9 +94,17 @@ void test()
|
|||||||
|
|
||||||
// basic_io_object functions.
|
// 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();
|
io_context& ioc_ref = socket1.get_io_context();
|
||||||
(void)ioc_ref;
|
(void)ioc_ref;
|
||||||
|
|
||||||
|
io_context& ioc_ref2 = socket1.get_io_service();
|
||||||
|
(void)ioc_ref2;
|
||||||
|
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||||
|
|
||||||
// basic_socket functions.
|
// basic_socket functions.
|
||||||
|
|
||||||
rp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
|
rp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
|
||||||
|
@ -90,9 +90,17 @@ void test()
|
|||||||
|
|
||||||
// basic_io_object functions.
|
// 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();
|
io_context& ioc_ref = socket1.get_io_context();
|
||||||
(void)ioc_ref;
|
(void)ioc_ref;
|
||||||
|
|
||||||
|
io_context& ioc_ref2 = socket1.get_io_service();
|
||||||
|
(void)ioc_ref2;
|
||||||
|
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||||
|
|
||||||
// basic_socket functions.
|
// basic_socket functions.
|
||||||
|
|
||||||
spp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
|
spp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
|
||||||
|
@ -104,9 +104,17 @@ void test()
|
|||||||
|
|
||||||
// basic_io_object functions.
|
// 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();
|
io_context& ioc_ref = socket1.get_io_context();
|
||||||
(void)ioc_ref;
|
(void)ioc_ref;
|
||||||
|
|
||||||
|
io_context& ioc_ref2 = socket1.get_io_service();
|
||||||
|
(void)ioc_ref2;
|
||||||
|
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||||
|
|
||||||
// basic_socket functions.
|
// basic_socket functions.
|
||||||
|
|
||||||
sp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
|
sp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
|
||||||
|
@ -31,6 +31,8 @@ public:
|
|||||||
|
|
||||||
typedef test_stream lowest_layer_type;
|
typedef test_stream lowest_layer_type;
|
||||||
|
|
||||||
|
typedef io_context_type::executor_type executor_type;
|
||||||
|
|
||||||
test_stream(asio::io_context& io_context)
|
test_stream(asio::io_context& io_context)
|
||||||
: io_context_(io_context)
|
: io_context_(io_context)
|
||||||
{
|
{
|
||||||
|
@ -31,6 +31,8 @@ public:
|
|||||||
|
|
||||||
typedef test_stream lowest_layer_type;
|
typedef test_stream lowest_layer_type;
|
||||||
|
|
||||||
|
typedef io_context_type::executor_type executor_type;
|
||||||
|
|
||||||
test_stream(asio::io_context& io_context)
|
test_stream(asio::io_context& io_context)
|
||||||
: io_context_(io_context)
|
: io_context_(io_context)
|
||||||
{
|
{
|
||||||
|
@ -86,9 +86,17 @@ void test()
|
|||||||
|
|
||||||
// basic_io_object functions.
|
// 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();
|
io_context& ioc_ref = port1.get_io_context();
|
||||||
(void)ioc_ref;
|
(void)ioc_ref;
|
||||||
|
|
||||||
|
io_context& ioc_ref2 = port1.get_io_service();
|
||||||
|
(void)ioc_ref2;
|
||||||
|
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||||
|
|
||||||
// basic_serial_port functions.
|
// basic_serial_port functions.
|
||||||
|
|
||||||
serial_port::lowest_layer_type& lowest_layer = port1.lowest_layer();
|
serial_port::lowest_layer_type& lowest_layer = port1.lowest_layer();
|
||||||
|
@ -52,9 +52,17 @@ void test()
|
|||||||
|
|
||||||
// basic_io_object functions.
|
// 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();
|
io_context& ioc_ref = set1.get_io_context();
|
||||||
(void)ioc_ref;
|
(void)ioc_ref;
|
||||||
|
|
||||||
|
io_context& ioc_ref2 = set1.get_io_service();
|
||||||
|
(void)ioc_ref2;
|
||||||
|
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||||
|
|
||||||
// basic_signal_set functions.
|
// basic_signal_set functions.
|
||||||
|
|
||||||
set1.add(1);
|
set1.add(1);
|
||||||
|
@ -77,9 +77,17 @@ void test()
|
|||||||
|
|
||||||
// basic_io_object functions.
|
// 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();
|
io_context& ioc_ref = stream1.get_io_context();
|
||||||
(void)ioc_ref;
|
(void)ioc_ref;
|
||||||
|
|
||||||
|
io_context& ioc_ref2 = stream1.get_io_service();
|
||||||
|
(void)ioc_ref2;
|
||||||
|
#endif // !defined(ASIO_NO_DEPRECATED)
|
||||||
|
|
||||||
// ssl::stream functions.
|
// ssl::stream functions.
|
||||||
|
|
||||||
SSL* ssl1 = stream1.native_handle();
|
SSL* ssl1 = stream1.native_handle();
|
||||||
|
Loading…
Reference in New Issue
Block a user