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

1435 Commits

Author SHA1 Message Date
Christopher Kohlhoff
0af7858e7b Version bump. 2022-08-04 00:11:08 +10:00
Christopher Kohlhoff
d9f5562ba7 Recreate the select_reactor's interrupter on a user-supplied thread, when using IOCP on Windows. 2022-08-03 14:10:10 +10:00
Christopher Kohlhoff
83880a798d Store reference to basic_yield_context in handler.
Improves performance by not copying the executor into the handler.
2022-08-01 09:09:30 +10:00
Christopher Kohlhoff
914c367395 Destroy spawned thread immediately if it completes within handler invocation. 2022-08-01 09:09:30 +10:00
Christopher Kohlhoff
c417121b1e Defend against Qt macros when using Intel C++. 2022-08-01 09:09:30 +10:00
Christopher Kohlhoff
ab543a1383 Remove faulty assertions from experimental::coro implementation. 2022-08-01 09:09:27 +10:00
Christopher Kohlhoff
c8fd215be3 Fix detection of aligned_alloc for Apple platforms. 2022-08-01 09:02:55 +10:00
Christopher Kohlhoff
fc901432c1 Change async_compose example to use return type compatible with new async_result form. 2022-08-01 09:02:35 +10:00
Christopher Kohlhoff
ce29925259 Avoid copying async operation object in await_transform. 2022-08-01 09:00:28 +10:00
Christopher Kohlhoff
9882b2ab11 Disable index_sequence emulation when variadic templates are unavailable. 2022-08-01 08:59:54 +10:00
Christopher Kohlhoff
ccc065c3f1 Fix usage of macro to detect std::exception_ptr. 2022-07-07 11:52:13 +10:00
Christopher Kohlhoff
56eaf73f92 Use deferred rather than use_awaitable in awaitable_operators implementation. 2022-07-07 00:27:15 +10:00
Christopher Kohlhoff
a3b5bfe85e Version bump. 2022-07-06 20:44:09 +10:00
Christopher Kohlhoff
ad5d852009 Fix compatibility with older compilers. 2022-07-06 19:41:20 +10:00
Christopher Kohlhoff
8948cfe348 Use local implementation of soon-to-be-deprecated std::aligned_storage. 2022-07-06 19:40:02 +10:00
Christopher Kohlhoff
d1f577e44a Require at least gcc 7.4 to enable aligned_alloc. 2022-07-05 20:53:31 +10:00
Christopher Kohlhoff
54b7d7f585 Use void* for socket address to match documented Endpoint requirements. 2022-07-05 20:41:28 +10:00
Christopher Kohlhoff
9e75820ee0 Add missing release() member functions to windows overlapped handles. 2022-07-05 20:27:16 +10:00
Christopher Kohlhoff
0733511a4c Add missing release() member functions to pipes. 2022-07-05 20:27:06 +10:00
Christopher Kohlhoff
cef3561699 Add missing throw-if-cancelled check when awaiting an async op directly. 2022-07-05 20:26:52 +10:00
Christopher Kohlhoff
2e10c1950a Fix -Wmaybe-uninitialized warnings. 2022-07-05 20:26:35 +10:00
Christopher Kohlhoff
eb8c4f0dab Propagate exceptions from awaited initiation functions through the resuming handler. 2022-07-05 20:26:24 +10:00
Christopher Kohlhoff
a528f972f4 Specifically exclude forced_unwind exceptions from catch-all. 2022-07-05 20:26:10 +10:00
Christopher Kohlhoff
1fcf107b8a Obtain associated allocator before handler is moved.
Fixes a sequencing issue in the implementation of post(), dispatch(),
and defer(), where the the associated allocator may be obtained from an
already moved-from completion handler.
2022-07-05 20:24:38 +10:00
Christopher Kohlhoff
a291cca82a Fix missing include. 2022-07-05 20:24:24 +10:00
Christopher Kohlhoff
46f49024e1 Removed all & race from promise - parallel_group covers most of it now. 2022-06-30 13:41:25 +10:00
Christopher Kohlhoff
fc5ed8c610 Fix issue where parallel_group initiation incorrectly moved arguments instead of forwarding them. 2022-06-30 13:40:59 +10:00
Christopher Kohlhoff
1e7a58f5fc Fix detection of invoke_result for clang/libc++. 2022-06-30 13:40:39 +10:00
Christopher Kohlhoff
8622bcdac0 Fix error location for windows overlapped and handle operations. 2022-06-30 12:47:37 +10:00
Christopher Kohlhoff
2eda791fcd Add converting move construction/assignment to pipes. 2022-06-30 12:17:54 +10:00
Christopher Kohlhoff
4ef2cd0054 Add converting move construction/assignment to serial ports. 2022-06-30 12:17:39 +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