2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-26 18:22:09 +00:00
Commit Graph

1255 Commits

Author SHA1 Message Date
Christopher Kohlhoff
a6f695ae55 More doc fixes for per-operation cancellation. 2021-08-05 11:23:31 +10:00
Christopher Kohlhoff
51583924ba Revert accidental code change in b12ae3da40. 2021-08-05 10:53:29 +10:00
Christopher Kohlhoff
b12ae3da40 Document per-operation cancellation for coroutines. 2021-08-05 10:31:54 +10:00
Christopher Kohlhoff
87f74576b9 Version bump. 2021-08-04 22:18:50 +10:00
Christopher Kohlhoff
d38deaa771 Add documentation for parallel_group. 2021-08-04 22:15:51 +10:00
Klemens
9369dbb269 Gcc fixes for promise & coro. 2021-08-03 17:56:56 +10:00
Christopher Kohlhoff
b0c59119b7 Ensure parallel_group respects operations' associated executors. 2021-08-01 18:30:53 +10:00
Christopher Kohlhoff
eda851faa9 Fix typo. 2021-08-01 18:26:49 +10:00
Christopher Kohlhoff
2c20ef0da1 Add missing move of executor. 2021-07-31 19:29:02 +10:00
Christopher Kohlhoff
0938b4e425 Fix posix::basic_stream_descriptor move operations.
They were only working when using the default executor.
2021-07-31 19:28:50 +10:00
Christopher Kohlhoff
1580a27777 Fix handler type requirements checking to reflect rvalue completion handler invocation. 2021-07-20 17:44:15 +10:00
Christopher Kohlhoff
318fee3a20 Fix compilation errors when dev_poll_reactor backend is used. 2021-07-20 17:43:27 +10:00
Christopher Kohlhoff
0ed8cce777 Enable 'expression SFINAE' for recent MSVC using /std:c++latest. 2021-07-20 17:43:11 +10:00
Christopher Kohlhoff
23246bec20 Use c++20 / coroutines with gcc10 build. 2021-07-17 12:59:04 +10:00
Christopher Kohlhoff
20ff7b2c1a Clean up memory recycling to ensure the cache size is used consistently. 2021-07-17 12:58:45 +10:00
Christopher Kohlhoff
2bfe4e9bf4 Fix argument evaluation order issue with a potentially moved-from variable. 2021-07-15 12:04:47 +10:00
Christopher Kohlhoff
31b21a0347 Add missing push/pop_options includes. 2021-07-15 12:04:39 +10:00
Christopher Kohlhoff
dc65ef1bfd Add tag to disambiguate deferred constructors. 2021-07-15 12:04:27 +10:00
Christopher Kohlhoff
9ee3a1673e Add missing lvalue-qualified overloads for operator(). 2021-07-15 12:04:16 +10:00
Christopher Kohlhoff
d70f7e4440 Add missing 'boost_' prefix to namespaces during boostification. 2021-07-15 12:04:02 +10:00
Christopher Kohlhoff
ada04ca76f Defend against macros defined by Qt. 2021-07-15 12:03:40 +10:00
Christopher Kohlhoff
e7f8e5eea5 Make awaitable_tag memory recycling use the configurable cache size. 2021-07-15 12:03:29 +10:00
Christopher Kohlhoff
f6d3a8c2ef Version bump. 2021-07-15 12:03:16 +10:00
Christopher Kohlhoff
a51b9b8198 Ensure un-cancelled ops are correctly placed back in the queue. 2021-07-11 22:03:29 +10:00
Christopher Kohlhoff
aafa4c6471 Document supported cancellation types. 2021-07-11 19:12:44 +10:00
Christopher Kohlhoff
2f207559f0 Fix compatibility with recent LibreSSL when OPENSSL_NO_SSL_INTERN is defined. 2021-07-11 16:45:55 +10:00
Christopher Kohlhoff
455729198e Disable coroutines support for the clang shipped with MSVC. 2021-07-11 16:45:42 +10:00
Christopher Kohlhoff
eb33daf680 Ensure gcc tests are not used for clang when detecting compiler/language features. 2021-07-11 16:45:12 +10:00
Christopher Kohlhoff
649dde15c9 Ensure handler alignment requirements are respected by cancellation_signal. 2021-07-11 10:20:19 +10:00
Christopher Kohlhoff
310dcb34b2 Fix order of _aligned_malloc arguments for MSVC. 2021-07-11 10:20:19 +10:00
Christopher Kohlhoff
99ebe28a64 Fix strand<> to avoid using a potentially moved-from executor. 2021-07-11 10:20:19 +10:00
Christopher Kohlhoff
c1fd78e785 Fix handling of move-only results with awaitable operators && and ||. 2021-07-11 10:20:19 +10:00
Christopher Kohlhoff
ef4e3d873c Add missing #includes for when using separate compilation. 2021-07-08 13:14:30 +10:00
Christopher Kohlhoff
c47d0007c5 Exclude is_deferred trait specialisations from the docs. 2021-07-08 00:50:38 +10:00
Christopher Kohlhoff
8f6bdef9e5 Version bump. 2021-07-07 22:47:51 +10:00
Christopher Kohlhoff
1570d3c352 Clean up source code for doxygen generation. 2021-07-07 20:21:14 +10:00
Christopher Kohlhoff
837f789484 Apply cancellation to a restarted AcceptEx operation. 2021-07-07 17:34:41 +10:00
Christopher Kohlhoff
87b84d2d1b Add cancellation slot support to IOCP sockets when using reactor-based operations. 2021-07-06 00:45:22 +10:00
Christopher Kohlhoff
77cf53057c Fix return_void() in experimental::coro. 2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
1961a5ca2a Fix execution_context concept definition. 2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
9134e26afe Remove unused lambda capture. 2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
769dc0e149 Add this_coro::throw_if_cancelled.
By default, awaitable<>-based coroutines now throw an exception if they
have been previously cancelled, and then try to perform a co_await
against another awaitable<>.

To disable this behaviour for the current awaitable<>-based "thread",
perform:

    co_await boost::asio::this_coro::throw_if_error(false);

It is then the responsibility of the coroutine implementation to ensure
that it checks the cancellation state of the coroutine manually, by
doing something like:

    auto cs = boost::asio::this_coro::cancellation_state;
    // ...
    if (cs.cancelled() != cancellation_type::none)
    {
      // ... handle cancellation ...
    }
2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
e711511742 Fixes for experimental::coro when using gcc 11. 2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
8c56568e3b Store awaitable_thread state in the bottom-of-stack promise. 2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
d2ab7b7669 Fix yield input in experimental::coro. 2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
386f7bac93 Add cancellation_slot support to IOCP-based handle operations. 2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
4b21d8768c Add cancellation_slot support to IOCP-based socket operations. 2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
01ca2be880 Ensure experimental::deferred header is self-contained. 2021-07-04 13:10:27 +10:00
Christopher Kohlhoff
f486b43c16 Add operator&& and operator|| for awaitable<>.
The logical operators || and && have been overloaded for awaitable<>, to
allow coroutines to be trivially awaited in parallel.

When awaited using &&, the await expression waits until both operations
have completed successfully. As a "short-circuit" evaluation, if one
operation fails with an exception, the other is immediately cancelled.
For example:

    std::tuple<std::size_t, std::size_t> results =
      co_await (
        async_read(socket, input_buffer, use_awaitable)
          && async_write(socket, output_buffer, use_awaitable)
      );

When awaited using ||, the await expression waits until either operation
succceeds. As a "short-circuit" evaluation, if one operation succeeds
without throwing an exception, the other is immediately cancelled. For
example:

    std::variant<std::size_t, std::monostate> results =
      co_await (
        async_read(socket, input_buffer, use_awaitable)
          || timer.async_wait(use_awaitable)
      );

The operators may be enabled by adding the #include:

    #include <asio/experimental/awaitable_operators.hpp>

and then bringing the contents of the experimental::awaitable_operators
namespace into scope:

    using namespace boost::asio::experimental::awaitable_operators;
2021-07-04 13:05:46 +10:00
Christopher Kohlhoff
a8c7e7e8c1 Add missing #includes, destructor. 2021-07-04 13:03:06 +10:00