2
0
mirror of https://github.com/boostorg/asio.git synced 2026-02-22 13:42:08 +00:00
Commit Graph

1516 Commits

Author SHA1 Message Date
Christopher Kohlhoff
d6a4d3b898 Add interoperability between channels and associated_immediate_executor. 2023-03-08 21:05:44 +11:00
Christopher Kohlhoff
9291f3d121 Remove spurious comment. 2023-03-08 21:05:25 +11:00
Christopher Kohlhoff
76fbcb2f45 Fix channels to support C++14 and (partially) C++11.
C++11 support is limited to channels with a single completion signature,
or channels with a void() signature (plus the error signature added by
the channel traits).
2023-03-08 21:05:14 +11:00
Christopher Kohlhoff
076089ec77 Fix deferred interoperability with multiple completion signatures. 2023-03-08 21:04:56 +11:00
Christopher Kohlhoff
e33be4b6b9 Fix execution context overloads of get_associated_executor and get_associated_immediate_executor. 2023-03-07 00:04:56 +11:00
Christopher Kohlhoff
adfeed2b5d Add any_completion_handler to the documentation. 2023-03-07 00:04:56 +11:00
Christopher Kohlhoff
4b16652320 Reset timer_thread_ in win_iocp_io_context::shutdown().
Resets timer_thread in shutdown for the case when shutdown is called
more than once.
2023-03-07 00:04:56 +11:00
Christopher Kohlhoff
d6cad8835e Expose sigaction() flags via optional argument to signal_set::add.
When registering a signal, it is now possible to pass flags that specify
the behaviour associated with the signal. These flags are specified as
an enum type in a new class, signal_set_base, and are passed to the
underlying sigaction() call. For example:

  asio::signal_set sigs(my_io_context);
  sigs.add(SIGINT, asio::signal_set::flags::restart);

Specifying flags other than flags::dont_care will fail unless
sigaction() is supported by the target operating system. Since signal
registration is global, conflicting flags (multiple registrations that
pass differing flags other than flags::dont_care) will also result in
an error.
2023-03-07 00:04:56 +11:00
Christopher Kohlhoff
c1269d1c82 Use uint64_t for OpenSSL options. 2023-03-06 23:38:59 +11:00
Christopher Kohlhoff
db1af40f2b Fix spurious operator precedence warning with MSVC. 2023-03-06 23:38:46 +11:00
Christopher Kohlhoff
5f39737f5a Suppress spurious 'potential null dereference' warnings. 2023-03-06 23:38:31 +11:00
Christopher Kohlhoff
7f2743e0d1 Prevent accidental copying of any_completion_handler. 2023-03-06 23:38:10 +11:00
Christopher Kohlhoff
d8e52891d4 Fix any_completion_handler assignment operator. 2023-03-06 23:37:56 +11:00
Christopher Kohlhoff
730441dcbb Ensure buffered messages can still be received when channel is closed. 2023-03-06 23:37:39 +11:00
Christopher Kohlhoff
03f3fa07f1 Fix use of nullptr. 2023-03-06 23:37:18 +11:00
Christopher Kohlhoff
d40e6257bb Explicitly shutdown in io_context and thread_pool destructor.
Fixes a use-after destroy when shutdown() is called from the base class
execution_context destructor, and this in turns triggers the destruction
of outstanding work objects.
2023-03-01 23:10:27 +11:00
Christopher Kohlhoff
85ee73854d Fix execution context overload of get_associated_executor. 2023-03-01 23:10:14 +11:00
Christopher Kohlhoff
d7525504d0 Fix initialization of sqe->user_data for reuse by io_uring_service.
The value of user_data in a submission queue entry is only initialized
with with the ring itself, remaining unchanged after use and even
through calls to io_uring_get_sqe(3). Many submission paths apply
io_uring_sqe_set_data(3) but the remainder are submitted with stale
values that can apply completion operations on the wrong queues with the
wrong results, causing obscure bugs.
2023-03-01 23:10:02 +11:00
Christopher Kohlhoff
7182202ae3 Fix pipe release() when using io_uring. 2023-03-01 23:09:50 +11:00
Christopher Kohlhoff
ae19c7b9a0 Fix thread_pool::join() deadlock when pool has no internal threads. 2023-03-01 23:09:16 +11:00
Christopher Kohlhoff
3c6101b636 Fix experimental::channel try_send failure after cancel. 2023-03-01 23:09:05 +11:00
Christopher Kohlhoff
87c178c9ea Fix awaitable exception pointer check typos. 2023-03-01 23:08:55 +11:00
Christopher Kohlhoff
d341036043 Add protocol for AF_UNIX+SOCK_SEQPACKET. 2023-03-01 23:08:42 +11:00
Christopher Kohlhoff
387f74f575 Add user-defined literals for asio buffer types.
The _buf literal suffix, defined in namespace asio::buffer_literals, may
be used to create const_buffer objects from string, binary integer, and
hexadecimal integer literals. These buffer literals may be arbitrarily
long. For example:

  using namespace asio::buffer_literals;

  asio::const_buffer b1 = "hello"_buf;
  asio::const_buffer b2 = 0xdeadbeef_buf;
  asio::const_buffer b3 = 0x01234567'89abcdef'01234567'89abcdef_buf;
  asio::const_buffer b4 = 0b1010101011001100_buf;

The memory associated with a buffer literal is valid for the lifetime of
the program. This means that the buffer can be safely used with
asynchronous operations:

  async_write(my_socket, "hello"_buf, my_handler);
2023-03-01 23:07:32 +11:00
Christopher Kohlhoff
50600cdb8f Fix ambiguity of associated_cancellation_slot<reference_wrapper>::get(). 2023-03-01 23:07:16 +11:00
Christopher Kohlhoff
6550b831d3 Support immediate completion with reactor-based sockets and descriptors. 2023-03-01 23:07:02 +11:00
Christopher Kohlhoff
1f2f4bc862 Change cancellation_slot_binder to support detection of unspecialised associators. 2023-03-01 23:06:32 +11:00
Christopher Kohlhoff
c35218f219 Change executor_binder to support detection of unspecialised associators. 2023-03-01 23:06:21 +11:00
Christopher Kohlhoff
55759280c2 Change allocator_binder to support detection of unspecialised associators. 2023-03-01 23:06:08 +11:00
Christopher Kohlhoff
0f5ed97183 Add bind_immediate_executor function and immediate_executor_binder adapter. 2023-03-01 23:05:44 +11:00
Christopher Kohlhoff
e199980569 Add associated_immediate_executor associator. 2023-03-01 23:04:58 +11:00
Christopher Kohlhoff
8fb8b1f6bb Move dispatch, post and defer initiation objects to detail headers. 2023-03-01 23:03:43 +11:00
Christopher Kohlhoff
35e93e4e90 Update copyright notices. 2023-03-01 23:03:03 +11:00
Christopher Kohlhoff
a1b17d8cac Version bump. 2022-12-07 22:17:23 +11:00
Christopher Kohlhoff
926058f20f Fix coroutine detection with recent Xcode. 2022-12-07 22:11:30 +11:00
Christopher Kohlhoff
f7ff39e66e Add missing include. 2022-12-07 07:36:02 +11:00
Christopher Kohlhoff
32b9ff6204 Fix detection of return type deduction with MSVC. 2022-12-07 07:35:50 +11:00
Christopher Kohlhoff
71907d44c5 Always enable std::invoke_result when targeting c++17 or later. 2022-12-07 07:35:27 +11:00
Christopher Kohlhoff
1941736519 Update detection of C++20 coroutine support on clang 14 and later.
This includes the ability to use coroutines with libstdc++.
2022-12-07 07:35:15 +11:00
Christopher Kohlhoff
2f124c3acb Add namespace qualifications to aligned_new and aligned_delete calls.
These functions are defined in the asio namespace but are called
from namespace asio_handler_alloc_helpers, hence the qualification
is needed.
2022-12-07 07:35:01 +11:00
Christopher Kohlhoff
d12b1a4f45 Add missing semicolon. 2022-12-07 07:34:50 +11:00
Christopher Kohlhoff
26fd5e9bb6 Fix the arguments to select_reactor::run. 2022-12-07 07:34:39 +11:00
Christopher Kohlhoff
7811479a80 Fix compatibility between co_spawn and any_completion_handler. 2022-12-07 07:34:26 +11:00
Christopher Kohlhoff
7fdff94997 Use snprintf rather than sprintf on latest Xcode. 2022-12-07 07:34:10 +11:00
Christopher Kohlhoff
e715db5fc4 Ensure spawn()'s completion handler is dispatched through the correct executor. 2022-12-07 07:33:54 +11:00
Christopher Kohlhoff
61796a5704 Dispatch cancellation handlers on the correct executor.
When a completion handler for spawn() or co_spawn() uses a specified
(i.e. non-default) associated executor, cancellation handlers need to
be dispatched to the executor that was passed to spawn() or co_spawn().
2022-12-07 07:33:39 +11:00
Christopher Kohlhoff
ce07af1fdf Fix namespace for co_composed's coroutine_traits specialisation. 2022-11-14 22:01:26 +11:00
Christopher Kohlhoff
dac750114c Version bump. 2022-11-09 23:23:56 +11:00
Christopher Kohlhoff
e874ca5aab Fall back to fcntl if ioctl fails with ENOTTY when setting non-blocking mode. 2022-11-09 21:57:53 +11:00
Christopher Kohlhoff
80fd0e2971 Constrain post/defer overloads on ability to require blocking.never. 2022-11-03 17:42:29 +11:00