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

427 Commits

Author SHA1 Message Date
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
Christopher Kohlhoff
63972a52c0 Add completion_signature_of trait.
The completion_signature_of trait (and corresponding type alias
completion_signature_of_t) may be used to determine the completion
signature of an asynchronous operation. For example:

  auto d = my_timer.async_wait(asio::deferred);
  using sig = asio::completion_signature_of<decltype(d)>::type;
  // sig is void(error_code)

or with a handcrafted asynchronous operation:

  struct my_async_op
  {
    asio::ip::tcp::socket& socket_ = ...;

    template <typename Token>
    auto operator()(asio::const_buffer data, Token&& token)
    {
      return asio::async_write(socket_, data,
          std::forward<Token>(token));
    }
  };

  using sig =
    asio::completion_signature_of<
      my_async_op, asio::const_buffer>::type;
  // sig is void(error_code, size_t)
2022-06-30 01:08:13 +10:00
Christopher Kohlhoff
73efb7492c Add is_async_operation trait and async_operation concept.
The is_async_operation trait may be used to determine if a function
object, and optional arguments, may be called to initiate an
asynchronous operation. For example, when using asio::deferred

  auto d = my_timer.async_wait(asio::deferred);
  static_assert(asio::is_async_operation<decltype(d)>::value);

or with a handcrafted asynchronous operation:

  struct my_async_op
  {
    asio::ip::tcp::socket& socket_ = ...;

    template <typename Token>
    auto operator()(asio::const_buffer data, Token&& token)
    {
      return asio::async_write(socket_, data,
          std::forward<Token>(token));
    }
  };

  static_assert(
      asio::is_async_operation<
        my_async_op, asio::const_buffer>::value);
2022-06-30 01:08:13 +10:00
Christopher Kohlhoff
4c216747dc Move deferred to the asio namespace.
This is no longer an experimental facility. The names deferred and
deferred_t have been temporarily retained as deprecated entities under
the asio::experimental namespace, for backwards compatibility.
2022-06-30 01:08:13 +10:00
Christopher Kohlhoff
34f5627723 Move prepend to the asio namespace.
This is no longer an experimental facility. The names prepend and
prepend_t have been temporarily retained as deprecated entities under
the asio::experimental namespace, for backwards compatibility.
2022-06-30 00:43:16 +10:00
Christopher Kohlhoff
f7356fbe90 Move append to the asio namespace.
This is no longer an experimental facility. The names append and
append_t have been temporarily retained as deprecated entities under
the asio::experimental namespace, for backwards compatibility.
2022-06-30 00:43:16 +10:00
Christopher Kohlhoff
a312a46715 Move as_tuple to the asio namespace.
This is no longer an experimental facility. The names as_tuple and
as_tuple_t have been temporarily retained as deprecated entities under
the asio::experimental namespace, for backwards compatibility.
2022-06-30 00:43:16 +10:00
Christopher Kohlhoff
e84f87060b Make experimental::deferred compatible with C++11. 2022-06-30 00:43:16 +10:00
Christopher Kohlhoff
756f67fab8 Use a trailing return type with decltype on initiating functions for C++11. 2022-06-30 00:43:16 +10:00
Christopher Kohlhoff
a7db875e4e Revision history. 2022-04-07 00:12:55 +10:00
Christopher Kohlhoff
a85fa9261c Add channels to the overview. 2022-04-06 23:40:40 +10:00
Christopher Kohlhoff
4b25ab9fe1 Note that I/O object constructors are passed executors or execution contexts. 2022-04-06 23:27:35 +10:00
Christopher Kohlhoff
e618fd4353 Work around code formatting problem in doc generation. 2022-04-06 23:24:39 +10:00
Christopher Kohlhoff
5cda4165b6 Add completion token cross-references to tutorial. 2022-04-06 23:21:35 +10:00
Christopher Kohlhoff
419fd5260f Add completion token cross-references. 2022-04-05 21:59:03 +10:00
Christopher Kohlhoff
d2fe233635 Remove broken wiki link. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
542b1ed2be Update platform macros documentation. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
9dd4e2c90e Add experimental::promise to the overview. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
0944e620b9 Add async_compose to the overview. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
95fa2c3708 Update timer overview in terms of waitable timers. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
2d8df86af0 Add pipes to overview. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
aa540d1aa8 Add files to overview. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
61b48741cc Add completion token adapters to the overview. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
5e42c30397 Add experimental::parallel_group to the overview. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
fca5406f5e Add experimental::deferred to the overview. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
903bab8f3c Move 'Futures' to 'Composition and Completion Tokens' section. 2022-04-05 21:59:02 +10:00
Christopher Kohlhoff
bfe61d8cc6 Regenerate documentation. 2022-04-05 17:07:22 +10:00
Christopher Kohlhoff
8a77375b02 Revision history. 2022-03-09 21:07:48 +11:00
Christopher Kohlhoff
5898a5279c Add C++14 examples of wrapping callback-based APIs. 2022-03-07 23:32:16 +11:00
Christopher Kohlhoff
ec00274244 Remove links to non-existing examples. 2022-03-07 23:29:18 +11:00
Christopher Kohlhoff
a2204b67f8 Add file descriptor passing examples to examples page. 2022-03-04 21:08:01 +11:00
Christopher Kohlhoff
55b8ecd62d Update Handler requirements. 2022-03-04 21:06:50 +11:00
Christopher Kohlhoff
e046e776d8 Update requirements on asynchronous operations. 2022-03-04 21:06:50 +11:00
Christopher Kohlhoff
d35b87ff27 Update documentation for dispatch, post, and defer. 2022-03-04 21:06:50 +11:00
Christopher Kohlhoff
8e69bf3cf3 Clarify the non-concurrency guarantees made for allocators. 2022-03-04 20:57:25 +11:00
Christopher Kohlhoff
2117b3ee7e Expose recycling_allocator as part of public interface. 2022-03-04 20:56:45 +11:00
Christopher Kohlhoff
644a222a89 Regenerate documentation. 2022-03-02 22:13:21 +11:00
Christopher Kohlhoff
7162c9675d Rework reference documentation in terms of completion tokens. 2022-03-02 22:13:21 +11:00
Christopher Kohlhoff
e935ce35ce Document per-operation cancellation for serial ports. 2022-03-02 22:13:21 +11:00
Christopher Kohlhoff
4e163b8ac1 Add cancellation_slot support to signal sets. 2022-03-02 22:13:21 +11:00
Christopher Kohlhoff
9208208d11 Add overview of asynchronous model. 2022-03-02 22:13:21 +11:00
Christopher Kohlhoff
59bce59911 Add example showing file descriptor passing over local sockets.
Thanks to Heiko Hund for providing this example.
2022-03-02 21:57:42 +11:00
Christopher Kohlhoff
3cd04eee90 Add bind_allocator. 2022-03-02 21:57:41 +11:00
Christopher Kohlhoff
ff58013a23 Update copyright notices. 2022-03-02 21:23:52 +11:00
Christopher Kohlhoff
2257543bb6 Revision history. 2021-12-02 10:02:47 +11:00
Christopher Kohlhoff
9e6b1e18a5 Link to channels example from documentation. 2021-12-02 10:02:47 +11:00
Christopher Kohlhoff
5b81086626 Regenerate documentation. 2021-11-17 08:58:13 +11:00
Christopher Kohlhoff
da52edb30f Add overview documentation for error handling with C++20 coroutines. 2021-11-17 08:41:51 +11:00
Christopher Kohlhoff
952eb39254 Clean up coro overview. 2021-11-17 08:41:29 +11:00