2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-28 06:42:08 +00: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
2022-11-01 11:00:15 +11:00
2021-03-04 09:02:43 +11:00
2022-03-02 21:23:52 +11:00
2006-06-14 22:26:36 +00:00
2021-11-01 21:19:46 +11:00
Description
Mirrored via gitea-mirror
24 MiB
Languages
C++ 99.6%
HTML 0.2%
Perl 0.2%