-
Notifications
You must be signed in to change notification settings - Fork 418
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework reference documentation in terms of completion tokens.
- Loading branch information
1 parent
e935ce3
commit 7162c96
Showing
67 changed files
with
3,420 additions
and
2,414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -740,15 +740,14 @@ | |
operation is launched with location information, it outputs lines using the | ||
[*<action>] [^n^m], prior to the [^n*m] line that signifies the beginning | ||
of the asynchronous operation. For example: | ||
`` | ||
[pre | ||
@asio|1589423304.861944|>7|ec=system:0,bytes_transferred=5 | ||
@asio|1589423304.861952|7^8|in 'async_write' (./../../../include/asio/impl/write.hpp:330) | ||
@asio|1589423304.861952|7^8|called from 'do_write' (handler_tracking/async_tcp_echo_server.cpp:62) | ||
@asio|1589423304.861952|7^8|called from 'operator()' (handler_tracking/async_tcp_echo_server.cpp:51) | ||
@asio|1589423304.861952|7*8|[email protected]_send | ||
@asio|1589423304.861975|.8|non_blocking_send,ec=system:0,bytes_transferred=5 | ||
@asio|1589423304.861980|<7| | ||
``[br] | ||
@asio|1589423304.861980|<7|][br] | ||
If `std::source_location` or `std::experimental::source_location` are | ||
available, the `use_awaitable_t` token (when default-constructed or used as a | ||
default completion token) will also cause handler tracking to output a source | ||
|
@@ -777,21 +776,18 @@ | |
include only those events in the tree that produced the nominated handlers. | ||
For example, to filter the output to include only the events associated with | ||
handlers `123`, `456`, and their predecessors: | ||
`` | ||
cat output.txt | perl handlertree.pl 123 456 | ||
`` | ||
[pre | ||
cat output.txt | perl handlertree.pl 123 456] | ||
or: | ||
`` | ||
perl handlertree.pl 123 456 < output.txt | ||
``[br] | ||
[pre | ||
perl handlertree.pl 123 456 < output.txt][br] | ||
This script may be combined with handerlive.pl and handlerviz.pl to produce a | ||
graph of the "live" asynchronous operation chains. For example: | ||
`` | ||
[pre | ||
cat output.txt | \ | ||
perl handlertree.pl `perl handlerlive.pl output.txt` | \ | ||
perl handlerviz.pl | \ | ||
dot -Tsvg > output.svg | ||
``[br] | ||
dot -Tsvg > output.svg][br] | ||
* Added changes for clang-based Embarcadero C++ compilers. | ||
* Fixed a deadlock that can occur when multiple threads concurrently initialise | ||
the Windows I/O completion port backend. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Copyright (c) 2003-2022 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) | ||
// | ||
|
||
/** | ||
\page asynchronous_operation asynchronous operation | ||
*/ | ||
|
||
/** | ||
\page completion_token completion token | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
[/ | ||
/ Copyright (c) 2003-2022 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) | ||
/] | ||
|
||
[section:AcceptToken Accept token requirements] | ||
|
||
A accept token is a [link boost_asio.overview.model.completion_tokens completion | ||
token] for completion signature `void(error_code)`. | ||
|
||
[heading Examples] | ||
|
||
A free function as a accept token: | ||
|
||
void accept_handler( | ||
const boost::system::error_code& ec) | ||
{ | ||
... | ||
} | ||
|
||
A accept token function object: | ||
|
||
struct accept_handler | ||
{ | ||
... | ||
void operator()( | ||
const boost::system::error_code& ec) | ||
{ | ||
... | ||
} | ||
... | ||
}; | ||
|
||
A lambda as a accept token: | ||
|
||
acceptor.async_accept(..., | ||
[](const boost::system::error_code& ec) | ||
{ | ||
... | ||
}); | ||
|
||
A non-static class member function adapted to a accept token using | ||
`std::bind()`: | ||
|
||
void my_class::accept_handler( | ||
const boost::system::error_code& ec) | ||
{ | ||
... | ||
} | ||
... | ||
acceptor.async_accept(..., | ||
std::bind(&my_class::accept_handler, | ||
this, std::placeholders::_1)); | ||
|
||
A non-static class member function adapted to a accept token using | ||
`boost::bind()`: | ||
|
||
void my_class::accept_handler( | ||
const boost::system::error_code& ec) | ||
{ | ||
... | ||
} | ||
... | ||
acceptor.async_accept(..., | ||
boost::bind(&my_class::accept_handler, | ||
this, boost::asio::placeholders::error)); | ||
|
||
Using [link boost_asio.reference.use_future use_future] as a accept token: | ||
|
||
std::future<void> f = acceptor.async_accept(..., boost::asio::use_future); | ||
... | ||
try | ||
{ | ||
f.get(); | ||
} | ||
catch (const system_error& e) | ||
{ | ||
... | ||
} | ||
|
||
Using [link boost_asio.reference.use_awaitable use_awaitable] as a accept token: | ||
|
||
boost::asio::awaitable<void> my_coroutine() | ||
{ | ||
try | ||
{ | ||
... | ||
co_await acceptor.async_accept(..., boost::asio::use_awaitable); | ||
... | ||
} | ||
catch (const system_error& e) | ||
{ | ||
... | ||
} | ||
} | ||
|
||
[endsect] |
Oops, something went wrong.