21 Commits

Author SHA1 Message Date
Christopher Kohlhoff 9cfa357fe8 Add cancel_after example. 2026-07-06 23:46:46 +10:00
Christopher Kohlhoff e385df66bd Update copyright notices. 2026-03-03 20:45:33 +11:00
Christopher Kohlhoff 1afbc5c12b Update copyright notices. 2025-03-04 22:57:26 +11:00
Christopher Kohlhoff 7e5ab33105 Fix spelling errors. 2024-12-03 08:39:39 +11:00
Rene Rivera a31cca5ec1 Add support for modular build structure. 2024-10-31 21:42:07 +11:00
Christopher Kohlhoff 6df0537864 Update operations/composed_6 exaple to also free delay_timer_.
Also the delay_timer_ member should be freed before calling the
user-supplied completion handler (as in the composed_7 and composed_8
examples).
2024-07-08 23:24:05 +10:00
Christopher Kohlhoff c83ee18458 Clean up spurious white space. 2024-06-27 23:01:17 +10:00
Christopher Kohlhoff 561e752d92 Update examples to use deferred as the default. 2024-06-26 22:42:54 +10:00
Christopher Kohlhoff c36d3ef338 Update copyright notices. 2024-03-05 07:51:17 +11:00
Christopher Kohlhoff dc3eb7c1aa Migrate remaining c++03 examples to c++11. 2023-12-07 00:23:31 +11:00
Christopher Kohlhoff 28ff1e7c2b Fix example file header comment. 2023-08-02 23:52:50 +10:00
Christopher Kohlhoff 447e8f0b34 Add a custom completion executor example. 2023-08-02 23:34:48 +10:00
Christopher Kohlhoff 2ca27525ba Add examples showing how to use channels for mutual exclusion. 2023-08-01 22:04:28 +10:00
Christopher Kohlhoff 35e93e4e90 Update copyright notices. 2023-03-01 23:03:03 +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 316250e5be Don't use deprecated conversion to endpoint. 2022-11-01 11:00:15 +11: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 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 ff58013a23 Update copyright notices. 2022-03-02 21:23:52 +11:00
Christopher Kohlhoff b428c745b9 Add channel-based proxy example. 2021-11-17 08:37:08 +11:00