From 84fe9fa40a534ddb730e1d502b0bcf8311862957 Mon Sep 17 00:00:00 2001 From: Klemens Date: Mon, 24 Apr 2023 19:27:42 +0800 Subject: [PATCH] First step toward immediate_executor. asio::async_compose doesn't know the immediate_executor however, so this seems somewhat incomplete, if not pointless. --- .../beast/_experimental/http/icy_stream.hpp | 12 +-- .../boost/beast/_experimental/test/stream.hpp | 12 +-- include/boost/beast/core/async_base.hpp | 64 +++++++++++---- include/boost/beast/core/basic_stream.hpp | 40 +++++----- .../boost/beast/core/buffered_read_stream.hpp | 16 ++-- .../boost/beast/core/buffers_generator.hpp | 9 ++- include/boost/beast/core/detail/read.hpp | 7 +- include/boost/beast/core/detect_ssl.hpp | 7 +- include/boost/beast/core/flat_stream.hpp | 12 +-- include/boost/beast/http/read.hpp | 28 ++++--- include/boost/beast/http/write.hpp | 35 +++++---- include/boost/beast/websocket/ssl.hpp | 7 +- include/boost/beast/websocket/stream.hpp | 78 +++++++++---------- include/boost/beast/websocket/teardown.hpp | 14 ++-- 14 files changed, 195 insertions(+), 146 deletions(-) diff --git a/include/boost/beast/_experimental/http/icy_stream.hpp b/include/boost/beast/_experimental/http/icy_stream.hpp index 81730b5801..5cb96fac3b 100644 --- a/include/boost/beast/_experimental/http/icy_stream.hpp +++ b/include/boost/beast/_experimental/http/icy_stream.hpp @@ -212,11 +212,11 @@ class icy_stream std::size_t bytes_transferred // Number of bytes read. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @note The `async_read_some` operation may not read all of the requested number of bytes. Consider using the function `net::async_read` if you need to ensure that the requested amount of data is read before the asynchronous @@ -295,11 +295,11 @@ class icy_stream std::size_t bytes_transferred // Number of bytes written. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @note The `async_write_some` operation may not transmit all of the data to the peer. Consider using the function `net::async_write` if you need to ensure that all data is written before the asynchronous operation completes. diff --git a/include/boost/beast/_experimental/test/stream.hpp b/include/boost/beast/_experimental/test/stream.hpp index 0f9cc809ed..98e931e9e2 100644 --- a/include/boost/beast/_experimental/test/stream.hpp +++ b/include/boost/beast/_experimental/test/stream.hpp @@ -454,11 +454,11 @@ class basic_stream std::size_t bytes_transferred // Number of bytes read. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @note The `async_read_some` operation may not read all of the requested number of bytes. Consider using the function `net::async_read` if you need to ensure that the requested amount of data is read before the asynchronous @@ -534,11 +534,11 @@ class basic_stream std::size_t bytes_transferred // Number of bytes written. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @note The `async_write_some` operation may not transmit all of the data to the peer. Consider using the function `net::async_write` if you need to ensure that all data is written before the asynchronous operation completes. diff --git a/include/boost/beast/core/async_base.hpp b/include/boost/beast/core/async_base.hpp index 6dd7b178bc..406c370702 100644 --- a/include/boost/beast/core/async_base.hpp +++ b/include/boost/beast/core/async_base.hpp @@ -18,10 +18,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -207,7 +209,25 @@ class async_base >::type; #endif -private: + /** The type of the immediate executor associated with this object. + + If a class derived from @ref boost::beast::async_base is a completion + handler, then the associated immediage executor of the derived class will + be this type. +*/ + using immediate_executor_type = +#if BOOST_BEAST_DOXYGEN + __implementation_defined__; +#else + typename + net::associated_immediate_executor< + Handler, + typename detail::select_work_guard_t::executor_type + >::type; +#endif + + + private: virtual void @@ -309,15 +329,29 @@ class async_base h_, wg1_.get_executor()); } - /** The type of cancellation_slot associated with this object. - - If a class derived from @ref async_base is a completion - handler, then the associated cancellation_slot of the - derived class will be this type. + /** Returns the executor associated with this object. - The default type is a filtering cancellation slot, - that only allows terminal cancellation. + If a class derived from @ref boost::beast::async_base is a completion + handler, then the object returned from this function will be used + as the associated executor of the derived class. */ + immediate_executor_type + get_immediate_executor() const noexcept + { + return net::get_associated_immediate_executor( + h_, wg1_.get_executor()); + } + + + /** The type of cancellation_slot associated with this object. + + If a class derived from @ref async_base is a completion + handler, then the associated cancellation_slot of the + derived class will be this type. + + The default type is a filtering cancellation slot, + that only allows terminal cancellation. + */ using cancellation_slot_type = beast::detail::filtering_cancellation_slot>; @@ -388,14 +422,12 @@ class async_base this->before_invoke_hook(); if(! is_continuation) { - auto const ex = get_executor(); - net::post( - wg1_.get_executor(), - net::bind_executor( - ex, - beast::bind_front_handler( - std::move(h_), - std::forward(args)...))); + auto const ex = get_immediate_executor(); + net::dispatch( + ex, + beast::bind_front_handler( + std::move(h_), + std::forward(args)...)); wg1_.reset(); } else diff --git a/include/boost/beast/core/basic_stream.hpp b/include/boost/beast/core/basic_stream.hpp index 19e9597464..315d718cea 100644 --- a/include/boost/beast/core/basic_stream.hpp +++ b/include/boost/beast/core/basic_stream.hpp @@ -928,8 +928,9 @@ class basic_stream error_code ec // Result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. @@ -993,8 +994,9 @@ class basic_stream typename Protocol::endpoint const& endpoint ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. @@ -1079,11 +1081,11 @@ class basic_stream typename Protocol::endpoint const& endpoint ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Example The following connect condition function object can be used to output information about the individual connection attempts: @@ -1173,11 +1175,11 @@ class basic_stream Iterator iterator ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following @@ -1244,11 +1246,11 @@ class basic_stream Iterator iterator ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following @@ -1377,11 +1379,11 @@ class basic_stream std::size_t bytes_transferred // Number of bytes read. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @note The `async_read_some` operation may not receive all of the requested number of bytes. Consider using the function `net::async_read` if you need to ensure that the requested amount of data is read before the asynchronous @@ -1511,11 +1513,11 @@ class basic_stream std::size_t bytes_transferred // Number of bytes written. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @note The `async_write_some` operation may not transmit all of the requested number of bytes. Consider using the function `net::async_write` if you need to ensure that the requested amount of data is sent before the asynchronous diff --git a/include/boost/beast/core/buffered_read_stream.hpp b/include/boost/beast/core/buffered_read_stream.hpp index 2d86a63180..98de6782f8 100644 --- a/include/boost/beast/core/buffered_read_stream.hpp +++ b/include/boost/beast/core/buffered_read_stream.hpp @@ -256,11 +256,11 @@ class buffered_read_stream std::size_t bytes_transferred // number of bytes transferred ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. - */ + manner equivalent to using `net::post`. */ template< class MutableBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 ReadHandler = @@ -335,11 +335,11 @@ class buffered_read_stream std::size_t bytes_transferred // number of bytes transferred ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. - */ + manner equivalent to using `net::post`. */ template< class ConstBufferSequence, BOOST_BEAST_ASYNC_TPARAM2 WriteHandler = diff --git a/include/boost/beast/core/buffers_generator.hpp b/include/boost/beast/core/buffers_generator.hpp index 5394865e00..dfc1c2a512 100644 --- a/include/boost/beast/core/buffers_generator.hpp +++ b/include/boost/beast/core/buffers_generator.hpp @@ -167,10 +167,11 @@ write( std::size_t bytes_transferred // the number of bytes written to the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from - within this function. Invocation of the handler will be - performed in a manner equivalent to using `net::post`. + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within + this function. Invocation of the handler will be performed in a + manner equivalent to using `net::post`. @see BuffersGenerator */ diff --git a/include/boost/beast/core/detail/read.hpp b/include/boost/beast/core/detail/read.hpp index 91a02b8321..e7d1c64361 100644 --- a/include/boost/beast/core/detail/read.hpp +++ b/include/boost/beast/core/detail/read.hpp @@ -210,10 +210,11 @@ read( // prior to the error. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. */ template< class AsyncReadStream, diff --git a/include/boost/beast/core/detect_ssl.hpp b/include/boost/beast/core/detect_ssl.hpp index b641b3ff2b..3d668728c2 100644 --- a/include/boost/beast/core/detect_ssl.hpp +++ b/include/boost/beast/core/detect_ssl.hpp @@ -308,10 +308,11 @@ detect_ssl( bool result // The result of the detector ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. */ template< class AsyncReadStream, diff --git a/include/boost/beast/core/flat_stream.hpp b/include/boost/beast/core/flat_stream.hpp index 913fdc3e10..0a464bc771 100644 --- a/include/boost/beast/core/flat_stream.hpp +++ b/include/boost/beast/core/flat_stream.hpp @@ -241,11 +241,11 @@ class flat_stream std::size_t bytes_transferred // Number of bytes read. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @note The `read_some` operation may not read all of the requested number of bytes. Consider using the function `net::async_read` if you need to ensure that the requested amount of data is read before the asynchronous @@ -323,11 +323,11 @@ class flat_stream std::size_t bytes_transferred // Number of bytes written. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @note The `async_write_some` operation may not transmit all of the data to the peer. Consider using the function `net::async_write` if you need to ensure that all data is written before the asynchronous operation completes. diff --git a/include/boost/beast/http/read.hpp b/include/boost/beast/http/read.hpp index 1d0d8e9ff9..8c32968ce9 100644 --- a/include/boost/beast/http/read.hpp +++ b/include/boost/beast/http/read.hpp @@ -192,10 +192,11 @@ read_some( std::size_t bytes_transferred // the total number of bytes transferred from the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @note The completion handler will receive as a parameter the total number of bytes transferred from the stream. This may be zero for the case where @@ -400,10 +401,11 @@ read_header( std::size_t bytes_transferred // the total number of bytes transferred from the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @note The completion handler will receive as a parameter the total number of bytes transferred from the stream. This may be zero for the case where @@ -610,10 +612,11 @@ read( std::size_t bytes_transferred // the total number of bytes transferred from the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @note The completion handler will receive as a parameter the total number of bytes transferred from the stream. This may be zero for the case where @@ -829,10 +832,11 @@ read( std::size_t bytes_transferred // the total number of bytes transferred from the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @note The completion handler will receive as a parameter the total number of bytes transferred from the stream. This may be zero for the case where diff --git a/include/boost/beast/http/write.hpp b/include/boost/beast/http/write.hpp index 50022e37a9..9af3f366ff 100644 --- a/include/boost/beast/http/write.hpp +++ b/include/boost/beast/http/write.hpp @@ -156,10 +156,11 @@ write_some( std::size_t bytes_transferred // the number of bytes written to the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @par Per-Operation Cancellation @@ -295,10 +296,11 @@ write_header( std::size_t bytes_transferred // the number of bytes written to the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @note The implementation will call @ref serializer::split with the value `true` on the serializer passed in. @@ -431,10 +433,11 @@ write( std::size_t bytes_transferred // the number of bytes written to the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @par Per-Operation Cancellation @@ -668,10 +671,11 @@ write( std::size_t bytes_transferred // the number of bytes written to the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @par Per-Operation Cancellation @@ -742,10 +746,11 @@ async_write( std::size_t bytes_transferred // the number of bytes written to the stream ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @par Per-Operation Cancellation diff --git a/include/boost/beast/websocket/ssl.hpp b/include/boost/beast/websocket/ssl.hpp index 3fe63f41f2..04eba4f689 100644 --- a/include/boost/beast/websocket/ssl.hpp +++ b/include/boost/beast/websocket/ssl.hpp @@ -63,10 +63,11 @@ teardown( error_code const& error // result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @par Per-Operation Cancellation diff --git a/include/boost/beast/websocket/stream.hpp b/include/boost/beast/websocket/stream.hpp index fdbf070762..b5a21877a9 100644 --- a/include/boost/beast/websocket/stream.hpp +++ b/include/boost/beast/websocket/stream.hpp @@ -931,11 +931,11 @@ class stream error_code const& ec // Result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Example @code ws.async_handshake("localhost", "/", @@ -1013,11 +1013,11 @@ class stream error_code const& ec // Result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Example @code response_type res; @@ -1354,11 +1354,11 @@ class stream error_code const& ec // Result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @see @li Websocket Opening Handshake Server Requirements (RFC6455) */ @@ -1421,11 +1421,11 @@ class stream error_code const& ec // Result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @see @li Websocket Opening Handshake Server Requirements (RFC6455) */ @@ -1486,11 +1486,11 @@ class stream error_code const& ec // Result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @see @li Websocket Opening Handshake Server Requirements (RFC6455) */ @@ -1622,11 +1622,11 @@ class stream error_code const& ec // Result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following @@ -1741,11 +1741,11 @@ class stream error_code const& ec // Result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following @@ -1864,11 +1864,11 @@ class stream error_code const& ec // Result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following @@ -2040,11 +2040,11 @@ class stream std::size_t bytes_written // Number of bytes appended to buffer ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following @@ -2234,11 +2234,11 @@ class stream std::size_t bytes_written // Number of bytes appended to buffer ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following @@ -2439,12 +2439,12 @@ class stream std::size_t bytes_written // Number of bytes written to the buffers ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following @@ -2578,11 +2578,11 @@ class stream // this will be less than the buffer_size. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following @@ -2717,11 +2717,11 @@ class stream // this will be less than the buffer_size. ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `net::post`. - @par Per-Operation Cancellation This asynchronous operation supports cancellation for the following diff --git a/include/boost/beast/websocket/teardown.hpp b/include/boost/beast/websocket/teardown.hpp index 5ffbdcd8d6..3701fe9562 100644 --- a/include/boost/beast/websocket/teardown.hpp +++ b/include/boost/beast/websocket/teardown.hpp @@ -78,10 +78,11 @@ teardown( error_code const& error // result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. */ template< @@ -158,10 +159,11 @@ teardown( error_code const& error // result of operation ); @endcode - Regardless of whether the asynchronous operation completes - immediately or not, the handler will not be invoked from within + If the handler has an associated immediate executor, + an immediate completion will be dispatched to it. + Otherwise, the handler will not be invoked from within this function. Invocation of the handler will be performed in a - manner equivalent to using `net::post`. + manner equivalent to using `net::post`.. @par Per-Operation Cancellation