// is_read_buffered.cpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2017 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)
#include <boost/asio/buffered_read_stream.hpp>
#include <boost/asio/buffered_write_stream.hpp>
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include "unit_test.hpp"
class test_stream
{
public:
- typedef boost::asio::io_service io_service_type;
+ typedef boost::asio::io_context io_context_type;
typedef test_stream lowest_layer_type;
- test_stream(boost::asio::io_service& io_service)
- : io_service_(io_service)
+ typedef io_context_type::executor_type executor_type;
+
+ test_stream(boost::asio::io_context& io_context)
+ : io_context_(io_context)
{
}
- io_service_type& io_service()
+ io_context_type& io_context()
{
- return io_service_;
+ return io_context_;
}
lowest_layer_type& lowest_layer()
void async_write(const Const_Buffers&, Handler handler)
{
boost::system::error_code error;
- io_service_.post(boost::asio::detail::bind_handler(handler, error, 0));
+ boost::asio::post(io_context_,
+ boost::asio::detail::bind_handler(handler, error, 0));
}
template <typename Mutable_Buffers>
void async_read(const Mutable_Buffers&, Handler handler)
{
boost::system::error_code error;
- io_service_.post(boost::asio::detail::bind_handler(handler, error, 0));
+ boost::asio::post(io_context_,
+ boost::asio::detail::bind_handler(handler, error, 0));
}
private:
- io_service_type& io_service_;
+ io_context_type& io_context_;
};
void is_read_buffered_test()