Christopher Kohlhoff
68ef2b45d4
Add channel buffer specialisation for R(error_code).
2022-11-01 11:35:07 +11:00
Christopher Kohlhoff
0e395856fb
Fix ambiguity in channel_traits specialisations.
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
3ac6b65011
Change semantics of 'dispatch' to mean the executor is used as-is.
2022-11-01 11:00:15 +11:00
Christopher Kohlhoff
316250e5be
Don't use deprecated conversion to endpoint.
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
689f94b9ab
Re-throw exception from top-level spawn()-ed function.
2022-11-01 10:44:37 +11:00
Christopher Kohlhoff
06d615d8ae
Allow a terminal-state spawned thread to run to completion when destroyed.
2022-11-01 10:44:37 +11:00
Christopher Kohlhoff
6579863625
Catch exceptions and rethrow outside of spawned thread.
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
1e81b83883
Change I/O objects to return their executors by const reference.
2022-11-01 09:47:23 +11:00
Christopher Kohlhoff
07f71caef2
Remove unnecessary specialisation of associated_cancellation_slot.
2022-11-01 09:30:28 +11:00
Christopher Kohlhoff
8be3d47f24
Add associated_cancellation_slot specialisation for std::reference_wrapper.
2022-11-01 09:30:18 +11:00
Christopher Kohlhoff
217986acc7
Use null pointers to implement empty execution::any_executor.
...
Improves performance of copy/move operations on empty executors.
2022-11-01 09:30:02 +11:00
Christopher Kohlhoff
8dd81fce89
Add nothrow constructor overloads to any_io_executor.
2022-11-01 09:29:46 +11:00
Christopher Kohlhoff
22f4d42fd6
Add nothrow constructor overloads to execution::any_executor<>.
2022-11-01 09:29:19 +11:00
Christopher Kohlhoff
49d11205b1
Add missing context query to use_future's executor.
2022-11-01 09:28:58 +11:00
Christopher Kohlhoff
0af7858e7b
Version bump.
2022-08-04 00:11:08 +10: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
d9f5562ba7
Recreate the select_reactor's interrupter on a user-supplied thread, when using IOCP on Windows.
2022-08-03 14:10:10 +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
83880a798d
Store reference to basic_yield_context in handler.
...
Improves performance by not copying the executor into the handler.
2022-08-01 09:09:30 +10:00
Christopher Kohlhoff
914c367395
Destroy spawned thread immediately if it completes within handler invocation.
2022-08-01 09:09:30 +10:00
Christopher Kohlhoff
c417121b1e
Defend against Qt macros when using Intel C++.
2022-08-01 09:09:30 +10:00
Christopher Kohlhoff
ab543a1383
Remove faulty assertions from experimental::coro implementation.
2022-08-01 09:09:27 +10:00
Christopher Kohlhoff
c8fd215be3
Fix detection of aligned_alloc for Apple platforms.
2022-08-01 09:02:55 +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
ce29925259
Avoid copying async operation object in await_transform.
2022-08-01 09:00:28 +10:00
Christopher Kohlhoff
9882b2ab11
Disable index_sequence emulation when variadic templates are unavailable.
2022-08-01 08:59:54 +10:00
Christopher Kohlhoff
ccc065c3f1
Fix usage of macro to detect std::exception_ptr.
2022-07-07 11:52:13 +10:00
Christopher Kohlhoff
56eaf73f92
Use deferred rather than use_awaitable in awaitable_operators implementation.
2022-07-07 00:27:15 +10:00
Christopher Kohlhoff
a3b5bfe85e
Version bump.
2022-07-06 20:44:09 +10:00
Christopher Kohlhoff
7c977f6e64
Revision history.
2022-07-06 20:43:22 +10:00
Christopher Kohlhoff
ad5d852009
Fix compatibility with older compilers.
2022-07-06 19:41:20 +10:00
Christopher Kohlhoff
8948cfe348
Use local implementation of soon-to-be-deprecated std::aligned_storage.
2022-07-06 19:40:02 +10:00
Christopher Kohlhoff
ebd0437f90
Regenerate documentation.
2022-07-05 23:49:58 +10:00
Christopher Kohlhoff
d1f577e44a
Require at least gcc 7.4 to enable aligned_alloc.
2022-07-05 20:53:31 +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
3292226107
Correctly mark compile-only test cases.
2022-07-05 20:41:39 +10:00
Christopher Kohlhoff
54b7d7f585
Use void* for socket address to match documented Endpoint requirements.
2022-07-05 20:41:28 +10:00
Christopher Kohlhoff
9e75820ee0
Add missing release() member functions to windows overlapped handles.
2022-07-05 20:27:16 +10:00
Christopher Kohlhoff
0733511a4c
Add missing release() member functions to pipes.
2022-07-05 20:27:06 +10:00
Christopher Kohlhoff
cef3561699
Add missing throw-if-cancelled check when awaiting an async op directly.
2022-07-05 20:26:52 +10:00