2
0
mirror of https://github.com/boostorg/asio.git synced 2026-02-28 03:22:08 +00:00
Commit Graph

1591 Commits

Author SHA1 Message Date
Christopher Kohlhoff
81ff304666 Add cancellation_slot support to async_connect. 2021-06-28 10:11:28 +10:00
Christopher Kohlhoff
8a697744bc Add cancellation_slot support to async_write. 2021-06-28 10:11:20 +10:00
Christopher Kohlhoff
210a325667 Add cancellation_slot support to async_read. 2021-06-28 10:11:06 +10:00
Christopher Kohlhoff
c6a83c0344 Add detail::base_from_cancellation_state helper class. 2021-06-28 10:10:57 +10:00
Christopher Kohlhoff
ca40143009 Add cancellation_slot support to awaitable<>-based coroutines. 2021-06-28 10:10:40 +10:00
Christopher Kohlhoff
4e9f42b73f Add cancellation_state. 2021-06-28 10:10:27 +10:00
Christopher Kohlhoff
f8b37f0c90 Add bind_cancellation_slot function and cancellation_slot_binder adapter. 2021-06-28 10:10:07 +10:00
Christopher Kohlhoff
e4f7cd3238 Add cancellation support to reactor-based sockets. 2021-06-28 10:09:20 +10:00
Christopher Kohlhoff
e16a4a1eaf Add cancellation_slot support to posix descriptors. 2021-06-28 10:09:12 +10:00
Christopher Kohlhoff
507ec5408e Add cancellation_slot support to timers. 2021-06-28 10:08:58 +10:00
Christopher Kohlhoff
6dc719f036 Add associated_cancellation_slot associator. 2021-06-28 10:08:23 +10:00
Christopher Kohlhoff
3521da0834 Add cancellation_signal and cancellation_slot. 2021-06-28 10:08:05 +10:00
Christopher Kohlhoff
23c2400f99 Add cancellation_type enum. 2021-06-28 10:07:51 +10:00
Christopher Kohlhoff
cbaf9ce318 The aligned_alloc function requires that size be a multiple of align. 2021-06-28 10:07:33 +10:00
Christopher Kohlhoff
5c006c4fea Fix detection of MSVC. 2021-06-28 10:07:24 +10:00
Christopher Kohlhoff
7d0397b0b3 Use std::aligned_alloc rather than operator new. 2021-06-28 10:07:15 +10:00
Christopher Kohlhoff
97d8a5686e Enable additional optimisations for any_executor and any_io_executor in detail::handler_work<>. 2021-06-11 19:08:46 +10:00
Christopher Kohlhoff
059c11aae5 Check feature-test macro for aligned new. 2021-06-11 19:08:35 +10:00
Christopher Kohlhoff
3ba403d306 Invoke completion handlers as rvalue references. 2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
aa311e118c Add experimental::as_tuple completion token adapter.
The as_tuple completion token adapter can be used to specify that the
completion handler arguments should be combined into a single tuple
argument.

The as_tuple adapter may be used in conjunction with use_awaitable and
structured bindings as follows:

    auto [e, n] = co_await socket.async_read_some(
        asio::buffer(data), as_tuple(use_awaitable));

Alternatively, it may be used as a default completion token like so:

    using default_token = as_tuple_t<use_awaitable_t<>>;
    using tcp_socket = default_token::as_default_on_t<tcp::socket>;
    // ...
    awaitable<void> do_read(tcp_socket socket)
    {
      // ...
      auto [e, n] = co_await socket.async_read_some(asio::buffer(data));
      // ...
    }
2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
059c40e935 Add initiate-based completion token support to bind_executor. 2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
99114f2b5a Use associator trait in buffered_write_stream implementation. 2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
bb6dd90ac4 Use associator trait in buffered_read_stream implementation. 2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
477d31f4d0 Use associator trait in spawn implementation. 2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
245fc00527 Add associator trait specialisation for async_compose implementation. 2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
2dd048a3c3 Use associator trait in ssl::stream implementation. 2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
32cdabd9d1 Use associator trait in async_connect implementation. 2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
7d48f439fa Use associator trait in async_write_at implementation. 2021-06-05 17:43:31 +10:00
Christopher Kohlhoff
3c5d092969 Use associator trait in async_write implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
50f31ae82f Use associator trait in async_read_until implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
d2b7968df4 Use associator trait in async_read_at implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
a9497b28f3 Use associator trait in async_read implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
60bd44c3f9 Use associator trait in detail::bind_handler implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
41f180f052 Use associator trait in redirect_error implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
793f6e25e3 Use associator trait in experimental::as_single implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
3bef12eea4 Use associator trait in bind_executor implementation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
e618857ff3 Add associator trait.
The associator trait is used to generically forward associators, such as
associated_executor<> and associated_allocator<>, through intermediate
completion handlers. For example:

    template <typename Handler>
    struct intermediate_handler
    {
      Handler handler_;

      template <typename... Args>
      void operator()(Args&... args)
      {
        // ...
      }
    };

    namespace boost {
    namespace asio {

      template <
          template <typename, typename> class Associator,
          typename Handler,
          typename DefaultCandidate>
      struct associator<
          Associator,
          intermediate_handler<Handler>,
          DefaultCandidate>
      {
        using type =
          typename Associator<Handler, DefaultCandidate>::type;

        static type get(
            const intermediate_handler<Handler>& h,
            const DefaultCandidate& c = DefaultCandidate()) noexcept
        {
          return Associator<Handler, DefaultCandidate>::get(
              h.handler_, c);
        }
      };

    } // namespace asio
    } // namespace boost
2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
9dfb1ab677 Ensure reactor headers include their dependencies. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
a3b94b6760 Use memset rather than assignment to fill UNIX domain addresses with NULs. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
8df5d67906 Initialise strings used for reverse name resolution. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
8a81ff990a Apply nodiscard attribute to awaitable<>. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
26d1132d3d Increase number of cached memory slots for default recycling allocator.
The number of per-thread slots may be configured at compile time by
defining ASIO_RECYCLING_ALLOCATOR_CACHE_SIZE to a non-negative integer.
If not defined, the default recycling allocator uses two slots.
2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
d9fffd9bce Regenerate platform macros documentation. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
bb8b2e2832 Make allocators respect alignment requirements.
This is important when completion handlers contain over-aligned members,
for example when captured in a lambda.

This uses operator new() with alignment support if available,
and falls back to Boost Align (again, if available).
2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
1bad8e0dba Add associated_executor and associated_allocator specialisations for std::reference_wrapper. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
1b161b5d91 Add constraints to use_awaitable_t::executor_with_default's constructor to prevent template instantiation recursion. 2021-06-05 17:43:30 +10:00
Christopher Kohlhoff
93fa0b53dd Fix any_io_executor equality operators. 2021-06-05 17:43:30 +10:00
Peter Dimov
c0b98039e4 Add CMakeLists.txt 2021-06-02 04:29:33 +03:00
Christopher Kohlhoff
558aeb8ea8 Version bump. 2021-04-07 17:32:29 +10:00
Christopher Kohlhoff
f807ab9aec Revision history. 2021-04-07 17:32:07 +10:00