Christopher Kohlhoff
464c141c28
Revision history.
2023-04-05 23:03:51 +10:00
Christopher Kohlhoff
5eb3c7e82a
Regenerate documentation.
2023-04-05 21:43:22 +10:00
Christopher Kohlhoff
a788ad8457
Fix links to experimental::promise reference page.
2023-04-05 21:43:14 +10:00
Christopher Kohlhoff
2b237955b4
Add immediate completion to the overview.
2023-04-05 21:08:23 +10:00
Christopher Kohlhoff
cedcfbec14
Add a link to the asio-debugger-extensions repository.
2023-04-05 21:08:23 +10:00
Christopher Kohlhoff
67ad756f4e
Add buffer literals to the documentation.
2023-04-05 21:08:23 +10:00
Christopher Kohlhoff
aba42faf19
Add co_composed to the overview.
2023-04-05 21:00:23 +10:00
Christopher Kohlhoff
e5abd8544c
Add any_completion_handler to the overview.
2023-04-05 21:00:23 +10:00
Christopher Kohlhoff
80c7f5224b
Add immediate completion to asynchronous operation requirements.
2023-04-05 21:00:23 +10:00
Christopher Kohlhoff
767d6ce8ca
Add missing sub macro.
2023-04-05 21:00:23 +10:00
Christopher Kohlhoff
0d4342efa0
Add new macro to doxygen configuration.
2023-04-05 19:34:42 +10:00
Christopher Kohlhoff
c538b13f94
Revision history.
2023-03-08 22:22:21 +11:00
Christopher Kohlhoff
b7b052304d
Regenerate documentation.
2023-03-08 22:11:09 +11:00
Christopher Kohlhoff
23e7730379
Fix doc generation for literal operators.
2023-03-07 08:20:23 +11:00
Christopher Kohlhoff
256d56ca01
Regenerate documentation.
2023-03-07 00:10:10 +11:00
Christopher Kohlhoff
adfeed2b5d
Add any_completion_handler to the documentation.
2023-03-07 00:04:56 +11:00
Christopher Kohlhoff
d341036043
Add protocol for AF_UNIX+SOCK_SEQPACKET.
2023-03-01 23:08:42 +11:00
Christopher Kohlhoff
6550b831d3
Support immediate completion with reactor-based sockets and descriptors.
2023-03-01 23:07:02 +11:00
Christopher Kohlhoff
0f5ed97183
Add bind_immediate_executor function and immediate_executor_binder adapter.
2023-03-01 23:05:44 +11:00
Christopher Kohlhoff
e199980569
Add associated_immediate_executor associator.
2023-03-01 23:04:58 +11:00
Christopher Kohlhoff
35e93e4e90
Update copyright notices.
2023-03-01 23:03:03 +11:00
Christopher Kohlhoff
47cf334752
Revision history.
2022-12-07 22:17:23 +11:00
Christopher Kohlhoff
3668ffb3c4
Add io_uring, updated Windows versions to implementation notes.
2022-12-07 20:37:59 +11:00
Christopher Kohlhoff
2e30d9e1be
Update async operation requirements to relax the requirements on the associated executor.
2022-12-07 20:37:44 +11:00
Christopher Kohlhoff
d5d33a7eda
Revision history.
2022-11-09 23:23:28 +11:00
Christopher Kohlhoff
09716d71f3
Enabled deferred awaiting for coros, regularized use_coro, and fixed allocator handling.
...
This means that use_coro does not return a coro object, just like
use_awaitable does, i.e. it's an overhead that buys us type erasure.
Allocators can now be set for coro by including allocator_arg in the
coro signature.
2022-11-03 17:29:53 +11:00
Christopher Kohlhoff
9e03478ba1
Add range-based experimental::make_parallel_group().
...
Added new overloads of experimental::make_parallel_group that may be used
to launch a dynamically-sized set of asynchronous operations, where all
operations are the same type. For example:
using op_type = decltype(
socket1.async_read_some(
boost::asio::buffer(data1),
boost::asio::deferred
)
);
std::vector<op_type> ops;
ops.push_back(
socket1.async_read_some(
boost::asio::buffer(data1),
boost::asio::deferred
)
);
ops.push_back(
socket2.async_read_some(
boost::asio::buffer(data2),
boost::asio::deferred
)
);
boost::asio::experimental::make_parallel_group(ops).async_wait(
boost::asio::experimental::wait_for_all(),
[](
std::vector<std::size_t> completion_order,
std::vector<boost::system::error_code> e,
std::vector<std::size_t> n
)
{
for (std::size_t i = 0; i < completion_order.size(); ++i)
{
std::size_t idx = completion_order[i];
std::cout << "socket " << idx << " finished: ";
std::cout << e[idx] << ", " << n[idx] << "\n";
}
}
);
Thanks go to Klemens Morgenstern for supplying part of this implementation.
2022-11-03 00:48:45 +11:00
Christopher Kohlhoff
7b8d9b4f5f
Fix link to experimental::co_composed.
2022-11-01 13:49:17 +11:00
Christopher Kohlhoff
6df6a90765
Fix consign documentation.
2022-11-01 13:47:47 +11:00
Christopher Kohlhoff
627de835cf
Regenerate documentation.
2022-11-01 11:35:07 +11:00
Christopher Kohlhoff
1c0f3c36be
Add experimental::co_composed.
...
The following example illustrates a simple asynchronous operation that
implements an echo protocol in terms of a coroutine:
template <typename CompletionToken>
auto async_echo(tcp::socket& socket,
CompletionToken&& token)
{
return boost::asio::async_initiate<
CompletionToken, void(boost::system::error_code)>(
boost::asio::experimental::co_composed<
void(boost::system::error_code)>(
[](auto state, tcp::socket& socket) -> void
{
try
{
state.throw_if_cancelled(true);
state.reset_cancellation_state(
boost::asio::enable_terminal_cancellation());
for (;;)
{
char data[1024];
std::size_t n = co_await socket.async_read_some(
boost::asio::buffer(data), boost::asio::deferred);
co_await boost::asio::async_write(socket,
boost::asio::buffer(data, n), boost::asio::deferred);
}
}
catch (const boost::system::system_error& e)
{
co_return {e.code()};
}
}, socket),
token, std::ref(socket));
}
2022-11-01 11:35:07 +11:00
Christopher Kohlhoff
64448e6a19
Add any_completion_handler<>.
...
The any_completion_handler<> template can be used to type-erase
completion handlers. A typical use case is to enable separate
compilation of asynchronous operation implementations. For example:
// Header file:
void async_sleep_impl(
boost::asio::any_completion_handler<void(boost::system::error_code)> handler,
boost::asio::any_io_executor ex, std::chrono::nanoseconds duration);
template <typename CompletionToken>
inline auto async_sleep(boost::asio::any_io_executor ex,
std::chrono::nanoseconds duration, CompletionToken&& token)
{
return boost::asio::async_initiate<CompletionToken, void(boost::system::error_code)>(
async_sleep_impl, token, std::move(ex), duration);
}
// Separately compiled source file:
void async_sleep_impl(
boost::asio::any_completion_handler<void(boost::system::error_code)> handler,
boost::asio::any_io_executor ex, std::chrono::nanoseconds duration)
{
auto timer = std::make_shared<boost::asio::steady_timer>(ex, duration);
timer->async_wait(boost::asio::consign(std::move(handler), timer));
}
2022-11-01 11:00:16 +11:00
Christopher Kohlhoff
5b4106c1a6
Add C++11 parallel_group example.
2022-11-01 11:00:16 +11:00
Christopher Kohlhoff
ed722fb0a3
Add consign completion token adapter.
...
The consign completion token adapter can be used to attach additional
values to a completion handler. This is typically used to keep at least
one copy of an object, such as a smart pointer, alive until the
completion handler is called.
For example:
auto timer1 = std::make_shared<boost::asio::steady_timer>(my_io_context);
timer1->expires_after(std::chrono::seconds(1));
timer1->async_wait(
boost::asio::consign(
[](boost::system::error_code ec)
{
// ...
},
timer1
)
);
auto timer2 = std::make_shared<boost::asio::steady_timer>(my_io_context);
timer2->expires_after(std::chrono::seconds(30));
std::future<void> f =
timer2->async_wait(
boost::asio::consign(
boost::asio::use_future,
timer2
)
);
2022-11-01 11:00:15 +11:00
Christopher Kohlhoff
9c9b76f0ee
Add any_completion_executor.
2022-11-01 11:00:15 +11:00
Christopher Kohlhoff
8603d5c39b
Deprecate concepts, traits, functions and customisation points related to senders and receivers.
2022-11-01 11:00:15 +11:00
Christopher Kohlhoff
17e08c23fe
Deprecate execution::execute member function.
...
Use execute as a member function.
2022-11-01 10:44:37 +11:00
Christopher Kohlhoff
324a91fd0a
Use deduced return types for all two-argument associator get functions.
2022-11-01 10:44:37 +11:00
Christopher Kohlhoff
2c7283e271
Update revision history.
2022-08-04 00:11:08 +10:00
Christopher Kohlhoff
90f8221694
Regenerate platform macros documentation.
2022-08-03 23:57:32 +10:00
Christopher Kohlhoff
32f8f72fcc
Add use_promise and use_promise_t to the quick reference.
2022-08-01 09:25:54 +10:00
Christopher Kohlhoff
fc901432c1
Change async_compose example to use return type compatible with new async_result form.
2022-08-01 09:02:35 +10:00
Christopher Kohlhoff
7c977f6e64
Revision history.
2022-07-06 20:43:22 +10:00
Christopher Kohlhoff
ebd0437f90
Regenerate documentation.
2022-07-05 23:49:58 +10:00
Christopher Kohlhoff
e1704e6fc4
Add coroutines examples for C++20.
2022-07-05 20:53:19 +10:00
Christopher Kohlhoff
64289a9111
Add composed operation examples for c++20.
2022-07-05 20:43:13 +10:00
Christopher Kohlhoff
46f49024e1
Removed all & race from promise - parallel_group covers most of it now.
2022-06-30 13:41:25 +10:00
Christopher Kohlhoff
1fcfcdbc67
Regenerate documentation.
2022-06-30 12:21:44 +10:00
Christopher Kohlhoff
723eee7a40
Regenerate documentation.
2022-06-30 01:18:45 +10:00
Christopher Kohlhoff
5bbdc9b709
Change spawn() to be a completion token-based async operation.
...
Added new spawn() overloads that conform to the requirements for
asynchronous operations. These overloads also support cancellation. When
targeting C++11 and later these functions are implemented in terms of
Boost.Context directly.
The existing overloads have been retained but are deprecated.
2022-06-30 01:18:45 +10:00