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

1285 Commits

Author SHA1 Message Date
Christopher Kohlhoff
46c729aa28 Use faster implementation for network_v4::canonical(). 2021-11-04 01:35:30 +11:00
Christopher Kohlhoff
c1a0c6a124 Fix gcc shadow warnings. 2021-11-04 01:35:20 +11:00
Christopher Kohlhoff
12deb90e5f Remove spurious include. 2021-11-04 01:35:04 +11:00
Christopher Kohlhoff
5a706991b5 Add missing file synchronisation functions. 2021-11-04 01:34:52 +11:00
Christopher Kohlhoff
d8359719e1 Add support for registered buffers.
The mutable_registered_buffer and const_registered_buffer classes are
buffer sequence types that represented registered buffers. These buffers
are obtained by first performing a buffer registration:

  auto my_registration =
    asio::register_buffers(
        my_execution_context,
        my_buffer_sequence);

The registration object must be maintained for as long as the buffer
registration is required. The supplied buffer sequence represents the
memory location or locations that will be registered, and the caller
must ensure they remain valid for as long as they are registered. The
registration is automatically removed when the registration object is
destroyed. There can be at most one active registration per execution
context.

The registration object is a container of registered buffers. Buffers
may be obtained from it by iterating over the container, or via direct
index access:

  asio::mutable_registered_buffer my_buffer
    = my_registration[i];

The registered buffers may then be passed directly to operations:

  asio::async_read(my_socket, my_buffer,
      [](error_code ec, size_t n)
      {
        // ...
      });

Buffer registration supports the io_uring backend when used with read
and write operations on descriptors, files, pipes, and sockets.
2021-10-29 20:54:56 +11:00
Christopher Kohlhoff
55eb04e646 Enable io_uring backend for pipes. 2021-10-29 20:51:06 +11:00
Christopher Kohlhoff
d81275f402 Only use io_uring for sockets if it's the default backend. 2021-10-29 20:50:49 +11:00
Christopher Kohlhoff
64fff52244 Only use io_uring for descriptors if it's the default backend. 2021-10-29 20:50:25 +11:00
Christopher Kohlhoff
8929b99528 Add missing documentation for parameter. 2021-10-27 13:50:32 +11:00
Christopher Kohlhoff
028630b0f8 Add support for portable pipes.
This change add supports for pipes on POSIX and Windows (when I/O
completion ports are available). For example, to create and use a
connected pair of pipe objects:

  asio::readable_pipe read_end;
  asio::writable_pipe write_end;
  asio::connect_pipe(read_end, write_end);

  write_end.async_write_some(my_write_buffer,
      [](error_code e, size_t n)
      {
        // ...
      });

  read_end.async_read_some(my_read_buffer,
      [](error_code e, size_t n)
      {
        // ...
      });
2021-10-27 13:47:03 +11:00
Christopher Kohlhoff
c6b9f33dcf Add support for files.
This change adds support for stream-oriented and random-access files.
For example, to write to a newly created stream-oriented file:

  asio::stream_file file(
      my_io_context, "/path/to/file",
      asio::stream_file::write_only
        | asio::stream_file::create
        | asio::stream_file::truncate);

  file.async_write_some(my_buffer,
      [](error_code e, size_t n)
      {
        // ...
      });

or to read from a random-access file:

  asio::random_access_file file(
      my_io_context, "/path/to/file",
      asio::random_access_file::read_only);

  file.async_read_some_at(1234, my_buffer,
      [](error_code e, size_t n)
      {
        // ...
      });

This feature currently supports I/O completion ports on Windows, and
io_uring on Linux (define BOOST_ASIO_HAS_IO_URING to enable).
2021-10-25 12:15:08 +11:00
Christopher Kohlhoff
292dcdcb94 Add io_uring backend.
Added support for using io_uring as the backend for all I/O objects,
including sockets, timers, and posix descriptors.

This backend is disabled by default, and must be enabled by defining
both BOOST_ASIO_HAS_IO_URING and BOOST_ASIO_DISABLE_EPOLL.

(Note: Simply defining BOOST_ASIO_HAS_IO_URING alone will enable the
backend without using it for the existing I/O objects. This allows it
to be used for I/O objects that require io_uring support, such as
files.)

This support depends on the liburing library at both compile and link
time. Add '-luring' to your list of libraries for linking.
2021-10-25 12:12:43 +11:00
Christopher Kohlhoff
70d12f5ebf Decouple the scheduler from the concrete task type. 2021-10-25 11:58:37 +11:00
Christopher Kohlhoff
f6186d659c Revert "Don't use shared_ptr in basic_socket_streambuf implementation." 2021-10-25 11:58:19 +11:00
Christopher Kohlhoff
7324fd94db Increase small object buffer size for any_executor. 2021-10-25 11:58:01 +11:00
Christopher Kohlhoff
4e405c2018 Reduce size of io_context executors to a single pointer. 2021-10-25 11:57:14 +11:00
Christopher Kohlhoff
f90ce170d5 Fix multi-signature handling when variadic templates are disabled. 2021-10-17 11:10:23 +11:00
Christopher Kohlhoff
9e220ac0c9 Add execution::is_executor<> specialisations for non-executors. 2021-10-17 11:09:57 +11:00
Christopher Kohlhoff
66ae046410 Add empty explicit specialisation of is_valid_target_executor<int, ...>. 2021-10-17 11:09:33 +11:00
Christopher Kohlhoff
a6c9608985 Enable separate compilation for cancellation_signal/slot. 2021-10-17 11:09:20 +11:00
Christopher Kohlhoff
98f58eec1f Enable separate compilation for any_io_executor. 2021-10-17 11:08:58 +11:00
Christopher Kohlhoff
737a2a0aa9 Don't use shared_ptr in basic_socket_streambuf implementation. 2021-10-17 11:05:21 +11:00
Christopher Kohlhoff
676b450e41 Add empty explicit specialisation composed_work_guard<system_executor>. 2021-10-17 11:04:48 +11:00
Christopher Kohlhoff
58050a2036 Enable ASIO_HAS_STD_INVOKE_RESULT with libc++13.
In c++20 mode std::result_of has been retired as per the standard,
causing compile errors.
2021-10-17 11:04:33 +11:00
Christopher Kohlhoff
bb05560d61 Disable non-virtual destructor warning on MSVC. 2021-10-17 11:04:17 +11:00
Christopher Kohlhoff
a8b564de46 Fix the initialisation order of members.
Reorder the constructor list in `win_iocp_socket_accept_op`, so that
`proxy_op` comes before `cancel_requested`, matching the order in which
these members are declared.

This addresses a warning that members are constructed out-of-order.
2021-10-17 11:03:58 +11:00
Christopher Kohlhoff
38e4883c21 Fix typo in io_context documentation (overlaod -> overload). 2021-10-17 11:03:31 +11:00
Christopher Kohlhoff
e2c30f4455 Fix compilation on Solaris. 2021-10-17 11:02:55 +11:00
Christopher Kohlhoff
138ff6f68f Fix defence against macros defined by Qt on MSVC. 2021-10-17 11:02:39 +11:00
Christopher Kohlhoff
290ccf5a73 Use declval in is_legacy_connect_condition check.
gcc 11.2 at -O3 rejects:

error: 'this' pointer is null [-Werror=nonnull]
   77 |         (*static_cast<legacy_connect_condition_helper<T, Iterator>*>(0))(
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
   78 |           *static_cast<const asio::error_code*>(0),
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   79 |           *static_cast<const Iterator*>(0)))) != 1;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-10-17 11:01:58 +11:00
Christopher Kohlhoff
a6f695ae55 More doc fixes for per-operation cancellation. 2021-08-05 11:23:31 +10:00
Christopher Kohlhoff
51583924ba Revert accidental code change in b12ae3da40. 2021-08-05 10:53:29 +10:00
Christopher Kohlhoff
b12ae3da40 Document per-operation cancellation for coroutines. 2021-08-05 10:31:54 +10:00
Christopher Kohlhoff
87f74576b9 Version bump. 2021-08-04 22:18:50 +10:00
Christopher Kohlhoff
d38deaa771 Add documentation for parallel_group. 2021-08-04 22:15:51 +10:00
Klemens
9369dbb269 Gcc fixes for promise & coro. 2021-08-03 17:56:56 +10:00
Christopher Kohlhoff
b0c59119b7 Ensure parallel_group respects operations' associated executors. 2021-08-01 18:30:53 +10:00
Christopher Kohlhoff
eda851faa9 Fix typo. 2021-08-01 18:26:49 +10:00
Christopher Kohlhoff
2c20ef0da1 Add missing move of executor. 2021-07-31 19:29:02 +10:00
Christopher Kohlhoff
0938b4e425 Fix posix::basic_stream_descriptor move operations.
They were only working when using the default executor.
2021-07-31 19:28:50 +10:00
Christopher Kohlhoff
1580a27777 Fix handler type requirements checking to reflect rvalue completion handler invocation. 2021-07-20 17:44:15 +10:00
Christopher Kohlhoff
318fee3a20 Fix compilation errors when dev_poll_reactor backend is used. 2021-07-20 17:43:27 +10:00
Christopher Kohlhoff
0ed8cce777 Enable 'expression SFINAE' for recent MSVC using /std:c++latest. 2021-07-20 17:43:11 +10:00
Christopher Kohlhoff
23246bec20 Use c++20 / coroutines with gcc10 build. 2021-07-17 12:59:04 +10:00
Christopher Kohlhoff
20ff7b2c1a Clean up memory recycling to ensure the cache size is used consistently. 2021-07-17 12:58:45 +10:00
Christopher Kohlhoff
2bfe4e9bf4 Fix argument evaluation order issue with a potentially moved-from variable. 2021-07-15 12:04:47 +10:00
Christopher Kohlhoff
31b21a0347 Add missing push/pop_options includes. 2021-07-15 12:04:39 +10:00
Christopher Kohlhoff
dc65ef1bfd Add tag to disambiguate deferred constructors. 2021-07-15 12:04:27 +10:00
Christopher Kohlhoff
9ee3a1673e Add missing lvalue-qualified overloads for operator(). 2021-07-15 12:04:16 +10:00
Christopher Kohlhoff
d70f7e4440 Add missing 'boost_' prefix to namespaces during boostification. 2021-07-15 12:04:02 +10:00