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

1879 Commits

Author SHA1 Message Date
Christopher Kohlhoff
4ef2cd0054 Add converting move construction/assignment to serial ports. 2022-06-30 12:17:39 +10:00
Christopher Kohlhoff
ca858d3ecd Add tests for converting move construction/assignment of files. 2022-06-30 12:17:16 +10:00
Christopher Kohlhoff
de2d299455 Add converting move construction/assignment to Windows stream and random-access handles. 2022-06-30 12:17:04 +10:00
Christopher Kohlhoff
5ce5e7e8ff Add converting move construction/assignment to Windows object_handle. 2022-06-30 12:16:44 +10:00
Christopher Kohlhoff
15e9e956b7 Add converting move construction/assignment to posix descriptors. 2022-06-30 12:16:25 +10:00
Christopher Kohlhoff
d4ad331588 Optimise move construction of I/O objects where only the executor type differs. 2022-06-30 12:16:04 +10:00
Christopher Kohlhoff
088c112908 Code formatting. 2022-06-30 12:15:48 +10:00
Christopher Kohlhoff
23f0cdd50c Fix there is no warning number 'XXXX' in windows.
In newer versions of MSVC a number of warning numbers which are disabled
in this header are removed so builds using boost asio gets spammed with
"there is no warning number 'XXXX'".
2022-06-30 12:15:19 +10:00
Christopher Kohlhoff
d09c389558 Explicitly state that shutdown(what) calls are thread-safe. 2022-06-30 12:15:08 +10:00
Christopher Kohlhoff
202a0689e8 Make gcc_x86_fenced_block compatible with -masm=intel. 2022-06-30 12:14:57 +10:00
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
74a94fe7f4 Fix compatibility with OpenSSL 3.0.4 and later. 2022-06-30 01:08:13 +10:00
Christopher Kohlhoff
aecb458f53 Allow awaitable<>-based coroutines to directly co_await operations.
Coroutines that use awaitable<> can now co_await asynchronous operations
that are packaged as function objects. For example:

  asio::awaitable<void> my_coro()
  {
    asio::steady_timer timer(co_await asio::this_coro::executor);
    timer.expires_after(std::chrono::seconds(5));

    co_await timer.async_wait(asio::deferred);
  }

or:

  asio::awaitable<void> my_coro()
  {
    asio::steady_timer timer(co_await asio::this_coro::executor);
    timer.expires_after(std::chrono::seconds(5));

    co_await [&](auto&& token)
    {
      return timer.async_wait(std::forward<decltype(token)>(token));
    };
  }
2022-06-30 01:08:13 +10:00
Christopher Kohlhoff
642f463a8d Use completion_signature_of in implementation of experimental::parallel_group. 2022-06-30 01:08:13 +10:00
Christopher Kohlhoff
089bc08805 Use completion_signature_of in implementation of deferred. 2022-06-30 01:08:13 +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
af93ac1ca9 Add buffer() overloads for contiguous containers, such as std::span. 2022-06-30 01:08:13 +10:00
Christopher Kohlhoff
50bf2971bf Add source location to error codes, when using Boost. 2022-06-30 01:08:13 +10:00
Christopher Kohlhoff
17d42b801f Add source locations to exceptions, when using Boost. 2022-06-30 01:08:13 +10:00
Christopher Kohlhoff
8d1ff9a010 Use separate function to clear error codes. 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
e7d03e9517 Make experimental::parallel_group compatible with C++11. 2022-06-30 00:43:16 +10:00
Christopher Kohlhoff
45bd682d9a Make experimental::prepend compatible with C++11. 2022-06-30 00:43:16 +10:00
Christopher Kohlhoff
6f8e8c847d Make experimental::append compatible with C++11. 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
69089bde72 Version bump. 2022-04-07 00:02:10 +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
c2b715cba3 Dispatch co_spawn cancellation through the executor, if the completion handler specifies its own associated executor. 2022-04-05 21:59:03 +10:00
Christopher Kohlhoff
a1f0d77515 Fix reset() so that it works on an unclosed channel. 2022-04-05 21:59:03 +10:00
Christopher Kohlhoff
03334bb123 For UNIX domain sockets on linux, connect() may yield EAGAIN to indicate an in-progress operation. 2022-04-05 21:59:03 +10:00
Christopher Kohlhoff
d96c300b20 Change promise to copy executor from first item before moving range. 2022-04-05 21:59:03 +10:00
Christopher Kohlhoff
fc15d1670d On Windows, use same share mode as files opened via fopen(). 2022-04-05 21:59:03 +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