mirror of
https://github.com/boostorg/asio.git
synced 2026-02-24 02:12:12 +00:00
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.
284 lines
14 KiB
Plaintext
284 lines
14 KiB
Plaintext
#
|
|
# Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
|
#
|
|
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
#
|
|
|
|
import feature ;
|
|
|
|
lib socket ; # SOLARIS, QNXNTO
|
|
lib nsl ; # SOLARIS
|
|
lib ws2_32 ; # NT
|
|
lib mswsock ; # NT
|
|
lib ipv6 ; # HPUX
|
|
lib network ; # HAIKU
|
|
|
|
local USE_SELECT =
|
|
<define>BOOST_ASIO_DISABLE_DEV_POLL
|
|
<define>BOOST_ASIO_DISABLE_EPOLL
|
|
<define>BOOST_ASIO_DISABLE_KQUEUE
|
|
<define>BOOST_ASIO_DISABLE_IOCP
|
|
;
|
|
|
|
project
|
|
: requirements
|
|
<library>/boost/date_time//boost_date_time
|
|
<library>/boost/system//boost_system
|
|
<library>/boost/chrono//boost_chrono
|
|
<library>/boost/regex//boost_regex
|
|
<define>BOOST_ALL_NO_LIB=1
|
|
<threading>multi
|
|
<target-os>linux:<define>_XOPEN_SOURCE=600
|
|
<target-os>linux:<define>_GNU_SOURCE=1
|
|
<target-os>solaris:<define>_XOPEN_SOURCE=500
|
|
<target-os>solaris:<define>__EXTENSIONS__
|
|
<target-os>solaris:<library>socket
|
|
<target-os>solaris:<library>nsl
|
|
<target-os>windows:<define>_WIN32_WINNT=0x0501
|
|
<target-os>windows,<toolset>cw:<library>ws2_32
|
|
<target-os>windows,<toolset>cw:<library>mswsock
|
|
<target-os>windows,<toolset>gcc:<library>ws2_32
|
|
<target-os>windows,<toolset>gcc:<library>mswsock
|
|
<target-os>windows,<toolset>gcc-cygwin:<define>__USE_W32_SOCKETS
|
|
<target-os>hpux,<toolset>gcc:<define>_XOPEN_SOURCE_EXTENDED
|
|
<target-os>hpux:<library>ipv6
|
|
<target-os>qnxnto:<library>socket
|
|
<target-os>haiku:<library>network
|
|
;
|
|
|
|
test-suite "asio" :
|
|
[ link associated_allocator.cpp ]
|
|
[ link associated_allocator.cpp : $(USE_SELECT) : associated_allocator_select ]
|
|
[ link associated_cancellation_slot.cpp ]
|
|
[ link associated_cancellation_slot.cpp : $(USE_SELECT) : associated_cancellation_slot_select ]
|
|
[ link associated_executor.cpp ]
|
|
[ link associated_executor.cpp : $(USE_SELECT) : associated_executor_select ]
|
|
[ link associator.cpp ]
|
|
[ link associator.cpp : $(USE_SELECT) : associator_select ]
|
|
[ link awaitable.cpp ]
|
|
[ link awaitable.cpp : $(USE_SELECT) : awaitable_select ]
|
|
[ link basic_datagram_socket.cpp ]
|
|
[ link basic_datagram_socket.cpp : $(USE_SELECT) : basic_datagram_socket_select ]
|
|
[ link basic_deadline_timer.cpp ]
|
|
[ link basic_deadline_timer.cpp : $(USE_SELECT) : basic_deadline_timer_select ]
|
|
[ link basic_file.cpp ]
|
|
[ link basic_file.cpp : $(USE_SELECT) : basic_file_select ]
|
|
[ link basic_random_access_file.cpp ]
|
|
[ link basic_random_access_file.cpp : $(USE_SELECT) : basic_random_access_file_select ]
|
|
[ link basic_raw_socket.cpp ]
|
|
[ link basic_raw_socket.cpp : $(USE_SELECT) : basic_raw_socket_select ]
|
|
[ link basic_readable_pipe.cpp ]
|
|
[ link basic_readable_pipe.cpp : $(USE_SELECT) : basic_readable_pipe_select ]
|
|
[ link basic_seq_packet_socket.cpp ]
|
|
[ link basic_seq_packet_socket.cpp : $(USE_SELECT) : basic_seq_packet_socket_select ]
|
|
[ link basic_signal_set.cpp ]
|
|
[ link basic_signal_set.cpp : $(USE_SELECT) : basic_signal_set_select ]
|
|
[ link basic_socket_acceptor.cpp ]
|
|
[ link basic_socket_acceptor.cpp : $(USE_SELECT) : basic_socket_acceptor_select ]
|
|
[ link basic_stream_file.cpp ]
|
|
[ link basic_stream_file.cpp : $(USE_SELECT) : basic_stream_file_select ]
|
|
[ link basic_stream_socket.cpp ]
|
|
[ link basic_stream_socket.cpp : $(USE_SELECT) : basic_stream_socket_select ]
|
|
[ link basic_streambuf.cpp ]
|
|
[ link basic_streambuf.cpp : $(USE_SELECT) : basic_streambuf_select ]
|
|
[ link basic_waitable_timer.cpp ]
|
|
[ link basic_waitable_timer.cpp : $(USE_SELECT) : basic_waitable_timer_select ]
|
|
[ link basic_writable_pipe.cpp ]
|
|
[ link basic_writable_pipe.cpp : $(USE_SELECT) : basic_writable_pipe_select ]
|
|
[ run bind_cancellation_slot.cpp ]
|
|
[ run bind_cancellation_slot.cpp : : : $(USE_SELECT) : bind_cancellation_slot_select ]
|
|
[ run buffer.cpp ]
|
|
[ run buffer.cpp : : : $(USE_SELECT) : buffer_select ]
|
|
[ link buffer_registration.cpp ]
|
|
[ link buffer_registration.cpp : $(USE_SELECT) : buffer_registration_select ]
|
|
[ run buffered_read_stream.cpp ]
|
|
[ run buffered_read_stream.cpp : : : $(USE_SELECT) : buffered_read_stream_select ]
|
|
[ run buffered_stream.cpp ]
|
|
[ run buffered_stream.cpp : : : $(USE_SELECT) : buffered_stream_select ]
|
|
[ run buffered_write_stream.cpp ]
|
|
[ run buffered_write_stream.cpp : : : $(USE_SELECT) : buffered_write_stream_select ]
|
|
[ run buffers_iterator.cpp ]
|
|
[ run buffers_iterator.cpp : : : $(USE_SELECT) : buffers_iterator_select ]
|
|
[ link cancellation_signal.cpp ]
|
|
[ link cancellation_signal.cpp : $(USE_SELECT) : cancellation_signal_select ]
|
|
[ link cancellation_state.cpp ]
|
|
[ link cancellation_state.cpp : $(USE_SELECT) : cancellation_state_select ]
|
|
[ link cancellation_type.cpp ]
|
|
[ link cancellation_type.cpp : $(USE_SELECT) : cancellation_type_select ]
|
|
[ link co_spawn.cpp ]
|
|
[ link co_spawn.cpp : $(USE_SELECT) : co_spawn_select ]
|
|
[ link completion_condition.cpp ]
|
|
[ link completion_condition.cpp : $(USE_SELECT) : completion_condition_select ]
|
|
[ run compose.cpp ]
|
|
[ run compose.cpp : : : $(USE_SELECT) : compose_select ]
|
|
[ link connect.cpp ]
|
|
[ link connect.cpp : $(USE_SELECT) : connect_select ]
|
|
[ run connect_pipe.cpp ]
|
|
[ run connect_pipe.cpp : : : $(USE_SELECT) : connect_pipe_select ]
|
|
[ link coroutine.cpp ]
|
|
[ link coroutine.cpp : $(USE_SELECT) : coroutine_select ]
|
|
[ run deadline_timer.cpp ]
|
|
[ run deadline_timer.cpp : : : $(USE_SELECT) : deadline_timer_select ]
|
|
[ link detached.cpp ]
|
|
[ link detached.cpp : $(USE_SELECT) : detached_select ]
|
|
[ run error.cpp ]
|
|
[ run error.cpp : : : $(USE_SELECT) : error_select ]
|
|
[ link file_base.cpp ]
|
|
[ link file_base.cpp : $(USE_SELECT) : file_base_select ]
|
|
[ link generic/basic_endpoint.cpp : : generic_basic_endpoint ]
|
|
[ link generic/basic_endpoint.cpp : $(USE_SELECT) : generic_basic_endpoint_select ]
|
|
[ link generic/datagram_protocol.cpp : : generic_datagram_protocol ]
|
|
[ link generic/datagram_protocol.cpp : $(USE_SELECT) : generic_datagram_protocol_select ]
|
|
[ link generic/raw_protocol.cpp : : generic_raw_protocol ]
|
|
[ link generic/raw_protocol.cpp : $(USE_SELECT) : generic_raw_protocol_select ]
|
|
[ link generic/seq_packet_protocol.cpp : : generic_seq_packet_protocol ]
|
|
[ link generic/seq_packet_protocol.cpp : $(USE_SELECT) : generic_seq_packet_protocol_select ]
|
|
[ link generic/stream_protocol.cpp : : generic_stream_protocol ]
|
|
[ link generic/stream_protocol.cpp : $(USE_SELECT) : generic_stream_protocol_select ]
|
|
[ link high_resolution_timer.cpp ]
|
|
[ link high_resolution_timer.cpp : $(USE_SELECT) : high_resolution_timer_select ]
|
|
[ run io_context.cpp ]
|
|
[ run io_context.cpp : : : $(USE_SELECT) : io_context_select ]
|
|
[ run io_context_strand.cpp ]
|
|
[ run io_context_strand.cpp : : : $(USE_SELECT) : io_context_strand_select ]
|
|
[ link ip/address.cpp : : ip_address ]
|
|
[ link ip/address.cpp : $(USE_SELECT) : ip_address_select ]
|
|
[ link ip/address_v4.cpp : : ip_address_v4 ]
|
|
[ link ip/address_v4.cpp : $(USE_SELECT) : ip_address_v4_select ]
|
|
[ link ip/address_v6.cpp : : ip_address_v6 ]
|
|
[ link ip/address_v6.cpp : $(USE_SELECT) : ip_address_v6_select ]
|
|
[ link ip/basic_endpoint.cpp : : ip_basic_endpoint ]
|
|
[ link ip/basic_endpoint.cpp : $(USE_SELECT) : ip_basic_endpoint_select ]
|
|
[ link ip/basic_resolver.cpp : : ip_basic_resolver ]
|
|
[ link ip/basic_resolver.cpp : $(USE_SELECT) : ip_basic_resolver_select ]
|
|
[ link ip/basic_resolver_entry.cpp : : ip_basic_resolver_entry ]
|
|
[ link ip/basic_resolver_entry.cpp : $(USE_SELECT) : ip_basic_resolver_entry_select ]
|
|
[ link ip/basic_resolver_iterator.cpp : : ip_basic_resolver_iterator ]
|
|
[ link ip/basic_resolver_iterator.cpp : $(USE_SELECT) : ip_basic_resolver_iterator_select ]
|
|
[ link ip/basic_resolver_query.cpp : : ip_basic_resolver_query ]
|
|
[ link ip/basic_resolver_query.cpp : $(USE_SELECT) : ip_basic_resolver_query_select ]
|
|
[ run ip/host_name.cpp : : : : ip_host_name ]
|
|
[ run ip/host_name.cpp : : : $(USE_SELECT) : ip_host_name_select ]
|
|
[ run ip/icmp.cpp : : : : ip_icmp ]
|
|
[ run ip/icmp.cpp : : : $(USE_SELECT) : ip_icmp_select ]
|
|
[ run ip/multicast.cpp : : : : ip_multicast ]
|
|
[ run ip/multicast.cpp : : : $(USE_SELECT) : ip_multicast_select ]
|
|
[ link ip/resolver_query_base.cpp : : ip_resolver_query_base ]
|
|
[ link ip/resolver_query_base.cpp : $(USE_SELECT) : ip_resolver_query_base_select ]
|
|
[ run ip/tcp.cpp : : : : ip_tcp ]
|
|
[ run ip/tcp.cpp : : : $(USE_SELECT) : ip_tcp_select ]
|
|
[ run ip/udp.cpp : : : : ip_udp ]
|
|
[ run ip/udp.cpp : : : $(USE_SELECT) : ip_udp_select ]
|
|
[ run ip/unicast.cpp : : : : ip_unicast ]
|
|
[ run ip/unicast.cpp : : : $(USE_SELECT) : ip_unicast_select ]
|
|
[ run ip/v6_only.cpp : : : : ip_v6_only ]
|
|
[ run ip/v6_only.cpp : : : $(USE_SELECT) : ip_v6_only_select ]
|
|
[ run is_read_buffered.cpp ]
|
|
[ run is_read_buffered.cpp : : : $(USE_SELECT) : is_read_buffered_select ]
|
|
[ run is_write_buffered.cpp ]
|
|
[ run is_write_buffered.cpp : : : $(USE_SELECT) : is_write_buffered_select ]
|
|
[ link local/basic_endpoint.cpp : : local_basic_endpoint ]
|
|
[ link local/basic_endpoint.cpp : $(USE_SELECT) : local_basic_endpoint_select ]
|
|
[ link local/connect_pair.cpp : : local_connect_pair ]
|
|
[ link local/connect_pair.cpp : $(USE_SELECT) : local_connect_pair_select ]
|
|
[ link local/datagram_protocol.cpp : : local_datagram_protocol ]
|
|
[ link local/datagram_protocol.cpp : $(USE_SELECT) : local_datagram_protocol_select ]
|
|
[ link local/stream_protocol.cpp : : local_stream_protocol ]
|
|
[ link local/stream_protocol.cpp : $(USE_SELECT) : local_stream_protocol_select ]
|
|
[ link placeholders.cpp ]
|
|
[ link placeholders.cpp : $(USE_SELECT) : placeholders_select ]
|
|
[ link posix/basic_descriptor.cpp : : posix_basic_descriptor ]
|
|
[ link posix/basic_descriptor.cpp : $(USE_SELECT) : posix_basic_descriptor_select ]
|
|
[ link posix/basic_stream_descriptor.cpp : : posix_basic_stream_descriptor ]
|
|
[ link posix/basic_stream_descriptor.cpp : $(USE_SELECT) : posix_basic_stream_descriptor_select ]
|
|
[ link posix/descriptor_base.cpp : : posix_descriptor_base ]
|
|
[ link posix/descriptor_base.cpp : $(USE_SELECT) : posix_descriptor_base_select ]
|
|
[ link posix/stream_descriptor.cpp : : posix_stream_descriptor ]
|
|
[ link posix/stream_descriptor.cpp : $(USE_SELECT) : posix_stream_descriptor_select ]
|
|
[ link random_access_file.cpp ]
|
|
[ link random_access_file.cpp : $(USE_SELECT) : random_access_file_select ]
|
|
[ run read.cpp ]
|
|
[ run read.cpp : : : $(USE_SELECT) : read_select ]
|
|
[ run read_at.cpp ]
|
|
[ run read_at.cpp : : : $(USE_SELECT) : read_at_select ]
|
|
[ run read_until.cpp ]
|
|
[ run read_until.cpp : : : $(USE_SELECT) : read_until_select ]
|
|
[ link readable_pipe.cpp ]
|
|
[ link readable_pipe.cpp : $(USE_SELECT) : readable_pipe_select ]
|
|
[ link redirect_error.cpp ]
|
|
[ link redirect_error.cpp : $(USE_SELECT) : redirect_error_select ]
|
|
[ link registered_buffer.cpp ]
|
|
[ link registered_buffer.cpp : $(USE_SELECT) : registered_buffer_select ]
|
|
[ run signal_set.cpp ]
|
|
[ run signal_set.cpp : : : $(USE_SELECT) : signal_set_select ]
|
|
[ run socket_base.cpp ]
|
|
[ run socket_base.cpp : : : $(USE_SELECT) : socket_base_select ]
|
|
[ run static_thread_pool.cpp ]
|
|
[ run static_thread_pool.cpp : : : $(USE_SELECT) : static_thread_pool_select ]
|
|
[ link steady_timer.cpp ]
|
|
[ link steady_timer.cpp : $(USE_SELECT) : steady_timer_select ]
|
|
[ run strand.cpp ]
|
|
[ run strand.cpp : : : $(USE_SELECT) : strand_select ]
|
|
[ link stream_file.cpp ]
|
|
[ link stream_file.cpp : $(USE_SELECT) : stream_file_select ]
|
|
[ run streambuf.cpp ]
|
|
[ run streambuf.cpp : : : $(USE_SELECT) : streambuf_select ]
|
|
[ link system_timer.cpp ]
|
|
[ link system_timer.cpp : $(USE_SELECT) : system_timer_select ]
|
|
[ link system_context.cpp ]
|
|
[ link system_context.cpp : $(USE_SELECT) : system_context_select ]
|
|
[ link system_executor.cpp ]
|
|
[ link system_executor.cpp : $(USE_SELECT) : system_executor_select ]
|
|
[ link this_coro.cpp ]
|
|
[ link this_coro.cpp : $(USE_SELECT) : this_coro_select ]
|
|
[ run thread_pool.cpp ]
|
|
[ run thread_pool.cpp : : : $(USE_SELECT) : thread_pool_select ]
|
|
[ link time_traits.cpp ]
|
|
[ link time_traits.cpp : $(USE_SELECT) : time_traits_select ]
|
|
[ link ts/buffer.cpp : : ts_buffer ]
|
|
[ link ts/buffer.cpp : $(USE_SELECT) : ts_buffer_select ]
|
|
[ link ts/executor.cpp : : ts_executor ]
|
|
[ link ts/executor.cpp : $(USE_SELECT) : ts_executor_select ]
|
|
[ link ts/internet.cpp : : ts_internet ]
|
|
[ link ts/internet.cpp : $(USE_SELECT) : ts_internet_select ]
|
|
[ link ts/io_context.cpp : : ts_io_context ]
|
|
[ link ts/io_context.cpp : $(USE_SELECT) : ts_io_context_select ]
|
|
[ link ts/net.cpp : : ts_net ]
|
|
[ link ts/net.cpp : $(USE_SELECT) : ts_net_select ]
|
|
[ link ts/netfwd.cpp : : ts_netfwd ]
|
|
[ link ts/netfwd.cpp : $(USE_SELECT) : ts_netfwd_select ]
|
|
[ link ts/socket.cpp : : ts_socket ]
|
|
[ link ts/socket.cpp : $(USE_SELECT) : ts_socket_select ]
|
|
[ link ts/timer.cpp : : ts_timer ]
|
|
[ link ts/timer.cpp : $(USE_SELECT) : ts_timer_select ]
|
|
[ link use_awaitable.cpp ]
|
|
[ link use_awaitable.cpp : $(USE_SELECT) : use_awaitable_select ]
|
|
[ link wait_traits.cpp ]
|
|
[ link wait_traits.cpp : $(USE_SELECT) : wait_traits_select ]
|
|
[ link windows/basic_object_handle.cpp : : windows_basic_object_handle ]
|
|
[ link windows/basic_object_handle.cpp : $(USE_SELECT) : windows_basic_object_handle_select ]
|
|
[ link windows/basic_overlapped_handle.cpp : : windows_basic_overlapped_handle ]
|
|
[ link windows/basic_overlapped_handle.cpp : $(USE_SELECT) : windows_basic_overlapped_handle_select ]
|
|
[ link windows/basic_random_access_handle.cpp : : windows_basic_random_access_handle ]
|
|
[ link windows/basic_random_access_handle.cpp : $(USE_SELECT) : windows_basic_random_access_handle_select ]
|
|
[ link windows/basic_stream_handle.cpp : : windows_basic_stream_handle ]
|
|
[ link windows/basic_stream_handle.cpp : $(USE_SELECT) : windows_basic_stream_handle_select ]
|
|
[ link windows/object_handle.cpp : : windows_object_handle ]
|
|
[ link windows/object_handle.cpp : $(USE_SELECT) : windows_object_handle_select ]
|
|
[ link windows/overlapped_ptr.cpp : : windows_overlapped_ptr ]
|
|
[ link windows/overlapped_ptr.cpp : $(USE_SELECT) : windows_overlapped_ptr_select ]
|
|
[ link windows/random_access_handle.cpp : : windows_random_access_handle ]
|
|
[ link windows/random_access_handle.cpp : $(USE_SELECT) : windows_random_access_handle_select ]
|
|
[ link windows/stream_handle.cpp : : windows_stream_handle ]
|
|
[ link windows/stream_handle.cpp : $(USE_SELECT) : windows_stream_handle_select ]
|
|
[ link writable_pipe.cpp ]
|
|
[ link writable_pipe.cpp : $(USE_SELECT) : writable_pipe_select ]
|
|
[ run write.cpp ]
|
|
[ run write.cpp : : : $(USE_SELECT) : write_select ]
|
|
[ run write_at.cpp ]
|
|
[ run write_at.cpp : : : $(USE_SELECT) : write_at_select ]
|
|
;
|
|
|
|
build-project execution ;
|