externals: Update boost to 1.72 and add Boost Context

This commit is contained in:
Fernando Sahmkow 2020-02-10 12:31:57 -04:00
parent 5e8300b76a
commit 77abe07b3b
618 changed files with 96299 additions and 14263 deletions

View file

@ -295,7 +295,7 @@ public:
* @note Following the move, the moved-from object is in the same state as if
* constructed using the @c basic_socket(const executor_type&) constructor.
*/
basic_socket(basic_socket&& other)
basic_socket(basic_socket&& other) BOOST_ASIO_NOEXCEPT
: impl_(std::move(other.impl_))
{
}
@ -940,11 +940,14 @@ public:
* socket.async_connect(endpoint, connect_handler);
* @endcode
*/
template <typename ConnectHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ConnectHandler,
template <
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code))
ConnectHandler BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ConnectHandler,
void (boost::system::error_code))
async_connect(const endpoint_type& peer_endpoint,
BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
BOOST_ASIO_MOVE_ARG(ConnectHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
{
boost::system::error_code open_ec;
if (!is_open())
@ -954,7 +957,7 @@ public:
}
return async_initiate<ConnectHandler, void (boost::system::error_code)>(
initiate_async_connect(), handler, this, peer_endpoint, open_ec);
initiate_async_connect(this), handler, peer_endpoint, open_ec);
}
/// Set an option on the socket.
@ -1770,13 +1773,17 @@ public:
* socket.async_wait(boost::asio::ip::tcp::socket::wait_read, wait_handler);
* @endcode
*/
template <typename WaitHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler,
template <
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code))
WaitHandler BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler,
void (boost::system::error_code))
async_wait(wait_type w, BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
async_wait(wait_type w,
BOOST_ASIO_MOVE_ARG(WaitHandler) handler
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
{
return async_initiate<WaitHandler, void (boost::system::error_code)>(
initiate_async_wait(), handler, this, w);
initiate_async_wait(this), handler, w);
}
protected:
@ -1805,11 +1812,24 @@ private:
basic_socket(const basic_socket&) BOOST_ASIO_DELETED;
basic_socket& operator=(const basic_socket&) BOOST_ASIO_DELETED;
struct initiate_async_connect
class initiate_async_connect
{
public:
typedef Executor executor_type;
explicit initiate_async_connect(basic_socket* self)
: self_(self)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
template <typename ConnectHandler>
void operator()(BOOST_ASIO_MOVE_ARG(ConnectHandler) handler,
basic_socket* self, const endpoint_type& peer_endpoint,
const endpoint_type& peer_endpoint,
const boost::system::error_code& open_ec) const
{
// If you get an error on the following line it means that your handler
@ -1818,35 +1838,53 @@ private:
if (open_ec)
{
boost::asio::post(self->impl_.get_executor(),
boost::asio::post(self_->impl_.get_executor(),
boost::asio::detail::bind_handler(
BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler), open_ec));
}
else
{
detail::non_const_lvalue<ConnectHandler> handler2(handler);
self->impl_.get_service().async_connect(
self->impl_.get_implementation(), peer_endpoint,
handler2.value, self->impl_.get_implementation_executor());
self_->impl_.get_service().async_connect(
self_->impl_.get_implementation(), peer_endpoint,
handler2.value, self_->impl_.get_implementation_executor());
}
}
private:
basic_socket* self_;
};
struct initiate_async_wait
class initiate_async_wait
{
public:
typedef Executor executor_type;
explicit initiate_async_wait(basic_socket* self)
: self_(self)
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
template <typename WaitHandler>
void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler,
basic_socket* self, wait_type w) const
void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler, wait_type w) const
{
// If you get an error on the following line it means that your handler
// does not meet the documented type requirements for a WaitHandler.
BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
detail::non_const_lvalue<WaitHandler> handler2(handler);
self->impl_.get_service().async_wait(
self->impl_.get_implementation(), w, handler2.value,
self->impl_.get_implementation_executor());
self_->impl_.get_service().async_wait(
self_->impl_.get_implementation(), w, handler2.value,
self_->impl_.get_implementation_executor());
}
private:
basic_socket* self_;
};
};