From c75fdff50b43a153b9f86a50cafea060487e21e7 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Fri, 2 Jun 2023 15:29:37 +0800 Subject: [PATCH] add coro_file (#295) --- cmake/module.cmake | 3 +- include/coro_io/coro_file.hpp | 233 ++++ include/coro_io/coro_io.hpp | 11 + src/coro_file/CMakeLists.txt | 0 src/coro_file/examples/CMakeLists.txt | 25 + src/coro_file/examples/main.cpp | 209 +++ src/coro_file/tests/CMakeLists.txt | 36 + src/coro_file/tests/main.cpp | 24 + src/coro_file/tests/test_corofile.cpp | 496 ++++++++ thirdparty/asio/asio.hpp | 18 +- .../asio/asio/any_completion_executor.hpp | 342 ----- .../asio/asio/any_completion_handler.hpp | 684 ---------- thirdparty/asio/asio/any_io_executor.hpp | 58 +- thirdparty/asio/asio/append.hpp | 2 +- thirdparty/asio/asio/as_tuple.hpp | 2 +- thirdparty/asio/asio/associated_allocator.hpp | 108 +- .../asio/associated_cancellation_slot.hpp | 78 +- thirdparty/asio/asio/associated_executor.hpp | 54 +- .../asio/associated_immediate_executor.hpp | 301 ----- thirdparty/asio/asio/associator.hpp | 2 +- thirdparty/asio/asio/async_result.hpp | 2 +- thirdparty/asio/asio/awaitable.hpp | 2 +- .../asio/asio/basic_datagram_socket.hpp | 10 +- thirdparty/asio/asio/basic_deadline_timer.hpp | 6 +- thirdparty/asio/asio/basic_file.hpp | 10 +- thirdparty/asio/asio/basic_io_object.hpp | 2 +- .../asio/asio/basic_random_access_file.hpp | 6 +- thirdparty/asio/asio/basic_raw_socket.hpp | 10 +- thirdparty/asio/asio/basic_readable_pipe.hpp | 6 +- .../asio/asio/basic_seq_packet_socket.hpp | 6 +- thirdparty/asio/asio/basic_serial_port.hpp | 8 +- thirdparty/asio/asio/basic_signal_set.hpp | 6 +- thirdparty/asio/asio/basic_socket.hpp | 8 +- .../asio/asio/basic_socket_acceptor.hpp | 10 +- .../asio/asio/basic_socket_iostream.hpp | 2 +- .../asio/asio/basic_socket_streambuf.hpp | 2 +- thirdparty/asio/asio/basic_stream_file.hpp | 6 +- thirdparty/asio/asio/basic_stream_socket.hpp | 6 +- thirdparty/asio/asio/basic_streambuf.hpp | 2 +- thirdparty/asio/asio/basic_streambuf_fwd.hpp | 2 +- thirdparty/asio/asio/basic_waitable_timer.hpp | 6 +- thirdparty/asio/asio/basic_writable_pipe.hpp | 6 +- thirdparty/asio/asio/bind_allocator.hpp | 21 +- .../asio/asio/bind_cancellation_slot.hpp | 22 +- thirdparty/asio/asio/bind_executor.hpp | 21 +- .../asio/asio/bind_immediate_executor.hpp | 736 ----------- thirdparty/asio/asio/buffer.hpp | 168 +-- thirdparty/asio/asio/buffer_registration.hpp | 2 +- thirdparty/asio/asio/buffered_read_stream.hpp | 2 +- .../asio/asio/buffered_read_stream_fwd.hpp | 2 +- thirdparty/asio/asio/buffered_stream.hpp | 2 +- thirdparty/asio/asio/buffered_stream_fwd.hpp | 2 +- .../asio/asio/buffered_write_stream.hpp | 2 +- .../asio/asio/buffered_write_stream_fwd.hpp | 2 +- thirdparty/asio/asio/buffers_iterator.hpp | 2 +- thirdparty/asio/asio/cancellation_signal.hpp | 2 +- thirdparty/asio/asio/cancellation_state.hpp | 2 +- thirdparty/asio/asio/cancellation_type.hpp | 2 +- thirdparty/asio/asio/co_spawn.hpp | 2 +- thirdparty/asio/asio/completion_condition.hpp | 2 +- thirdparty/asio/asio/compose.hpp | 337 ++++- thirdparty/asio/asio/connect.hpp | 2 +- thirdparty/asio/asio/connect_pipe.hpp | 2 +- thirdparty/asio/asio/consign.hpp | 88 -- thirdparty/asio/asio/coroutine.hpp | 2 +- thirdparty/asio/asio/deadline_timer.hpp | 2 +- thirdparty/asio/asio/defer.hpp | 66 +- thirdparty/asio/asio/deferred.hpp | 2 +- thirdparty/asio/asio/detached.hpp | 2 +- thirdparty/asio/asio/detail/array.hpp | 2 +- thirdparty/asio/asio/detail/array_fwd.hpp | 2 +- thirdparty/asio/asio/detail/assert.hpp | 2 +- thirdparty/asio/asio/detail/atomic_count.hpp | 2 +- .../detail/base_from_cancellation_state.hpp | 2 +- .../asio/detail/base_from_completion_cond.hpp | 2 +- thirdparty/asio/asio/detail/bind_handler.hpp | 124 +- .../asio/asio/detail/blocking_executor_op.hpp | 2 +- .../asio/asio/detail/buffer_resize_guard.hpp | 2 +- .../asio/detail/buffer_sequence_adapter.hpp | 2 +- .../asio/detail/buffered_stream_storage.hpp | 2 +- .../asio/asio/detail/bulk_executor_op.hpp | 2 +- thirdparty/asio/asio/detail/call_stack.hpp | 2 +- thirdparty/asio/asio/detail/chrono.hpp | 2 +- .../asio/asio/detail/chrono_time_traits.hpp | 2 +- .../asio/asio/detail/completion_handler.hpp | 2 +- thirdparty/asio/asio/detail/composed_work.hpp | 328 ----- .../asio/asio/detail/concurrency_hint.hpp | 2 +- .../detail/conditionally_enabled_event.hpp | 2 +- .../detail/conditionally_enabled_mutex.hpp | 2 +- thirdparty/asio/asio/detail/config.hpp | 122 +- .../asio/asio/detail/consuming_buffers.hpp | 2 +- thirdparty/asio/asio/detail/cstddef.hpp | 2 +- thirdparty/asio/asio/detail/cstdint.hpp | 2 +- thirdparty/asio/asio/detail/date_time_fwd.hpp | 2 +- .../asio/detail/deadline_timer_service.hpp | 2 +- .../asio/asio/detail/dependent_type.hpp | 2 +- .../asio/asio/detail/descriptor_ops.hpp | 2 +- .../asio/asio/detail/descriptor_read_op.hpp | 37 +- .../asio/asio/detail/descriptor_write_op.hpp | 36 +- .../asio/asio/detail/dev_poll_reactor.hpp | 24 +- thirdparty/asio/asio/detail/epoll_reactor.hpp | 23 +- thirdparty/asio/asio/detail/event.hpp | 2 +- .../detail/eventfd_select_interrupter.hpp | 2 +- thirdparty/asio/asio/detail/exception.hpp | 2 +- .../asio/asio/detail/executor_function.hpp | 2 +- thirdparty/asio/asio/detail/executor_op.hpp | 2 +- .../asio/asio/detail/fd_set_adapter.hpp | 2 +- thirdparty/asio/asio/detail/fenced_block.hpp | 2 +- thirdparty/asio/asio/detail/functional.hpp | 2 +- thirdparty/asio/asio/detail/future.hpp | 2 +- .../asio/asio/detail/gcc_arm_fenced_block.hpp | 2 +- .../asio/detail/gcc_hppa_fenced_block.hpp | 2 +- .../asio/detail/gcc_sync_fenced_block.hpp | 2 +- .../asio/asio/detail/gcc_x86_fenced_block.hpp | 2 +- thirdparty/asio/asio/detail/global.hpp | 2 +- .../asio/detail/handler_alloc_helpers.hpp | 10 +- .../asio/asio/detail/handler_cont_helpers.hpp | 2 +- .../asio/detail/handler_invoke_helpers.hpp | 2 +- .../asio/asio/detail/handler_tracking.hpp | 2 +- .../asio/detail/handler_type_requirements.hpp | 2 +- thirdparty/asio/asio/detail/handler_work.hpp | 64 +- thirdparty/asio/asio/detail/hash_map.hpp | 2 +- .../detail/impl/buffer_sequence_adapter.ipp | 2 +- .../asio/asio/detail/impl/descriptor_ops.ipp | 39 +- .../asio/detail/impl/dev_poll_reactor.hpp | 4 +- .../asio/detail/impl/dev_poll_reactor.ipp | 17 +- .../asio/asio/detail/impl/epoll_reactor.hpp | 4 +- .../asio/asio/detail/impl/epoll_reactor.ipp | 25 +- .../impl/eventfd_select_interrupter.ipp | 2 +- .../asio/detail/impl/handler_tracking.ipp | 6 +- .../impl/io_uring_descriptor_service.ipp | 2 +- .../detail/impl/io_uring_file_service.ipp | 2 +- .../asio/detail/impl/io_uring_service.hpp | 2 +- .../asio/detail/impl/io_uring_service.ipp | 5 +- .../impl/io_uring_socket_service_base.ipp | 2 +- .../asio/asio/detail/impl/kqueue_reactor.hpp | 4 +- .../asio/asio/detail/impl/kqueue_reactor.ipp | 21 +- .../impl/lib_aio_descriptor_service.ipp | 178 --- .../asio/detail/impl/lib_aio_file_service.ipp | 139 -- .../asio/asio/detail/impl/null_event.ipp | 2 +- .../detail/impl/pipe_select_interrupter.ipp | 2 +- .../asio/asio/detail/impl/posix_event.ipp | 2 +- .../asio/asio/detail/impl/posix_mutex.ipp | 2 +- .../detail/impl/posix_serial_port_service.ipp | 2 +- .../asio/asio/detail/impl/posix_thread.ipp | 2 +- .../asio/asio/detail/impl/posix_tss_ptr.ipp | 2 +- .../impl/reactive_descriptor_service.ipp | 16 +- .../impl/reactive_socket_service_base.ipp | 42 +- .../detail/impl/resolver_service_base.ipp | 2 +- .../asio/asio/detail/impl/scheduler.ipp | 2 +- .../asio/asio/detail/impl/select_reactor.hpp | 4 +- .../asio/asio/detail/impl/select_reactor.ipp | 18 +- .../asio/detail/impl/service_registry.hpp | 2 +- .../asio/detail/impl/service_registry.ipp | 2 +- .../asio/detail/impl/signal_set_service.ipp | 2 +- .../asio/asio/detail/impl/socket_ops.ipp | 14 +- .../detail/impl/socket_select_interrupter.ipp | 2 +- .../detail/impl/strand_executor_service.hpp | 17 +- .../detail/impl/strand_executor_service.ipp | 2 +- .../asio/asio/detail/impl/strand_service.hpp | 2 +- .../asio/asio/detail/impl/strand_service.ipp | 2 +- .../asio/asio/detail/impl/thread_context.ipp | 2 +- .../asio/asio/detail/impl/throw_error.ipp | 2 +- .../asio/detail/impl/timer_queue_ptime.ipp | 2 +- .../asio/asio/detail/impl/timer_queue_set.ipp | 2 +- .../asio/asio/detail/impl/win_event.ipp | 2 +- .../detail/impl/win_iocp_file_service.ipp | 2 +- .../detail/impl/win_iocp_handle_service.ipp | 3 +- .../asio/detail/impl/win_iocp_io_context.hpp | 2 +- .../asio/detail/impl/win_iocp_io_context.ipp | 2 +- .../impl/win_iocp_serial_port_service.ipp | 2 +- .../impl/win_iocp_socket_service_base.ipp | 2 +- .../asio/asio/detail/impl/win_mutex.ipp | 2 +- .../detail/impl/win_object_handle_service.ipp | 2 +- .../asio/detail/impl/win_static_mutex.ipp | 2 +- .../asio/asio/detail/impl/win_thread.ipp | 2 +- .../asio/asio/detail/impl/win_tss_ptr.ipp | 2 +- .../impl/winrt_ssocket_service_base.ipp | 2 +- .../detail/impl/winrt_timer_scheduler.hpp | 2 +- .../detail/impl/winrt_timer_scheduler.ipp | 2 +- .../asio/asio/detail/impl/winsock_init.ipp | 2 +- thirdparty/asio/asio/detail/io_control.hpp | 2 +- .../asio/asio/detail/io_object_impl.hpp | 2 +- .../detail/io_uring_descriptor_read_at_op.hpp | 2 +- .../detail/io_uring_descriptor_read_op.hpp | 2 +- .../detail/io_uring_descriptor_service.hpp | 10 +- .../io_uring_descriptor_write_at_op.hpp | 2 +- .../detail/io_uring_descriptor_write_op.hpp | 2 +- .../asio/detail/io_uring_file_service.hpp | 5 +- .../asio/detail/io_uring_null_buffers_op.hpp | 2 +- .../asio/asio/detail/io_uring_operation.hpp | 2 +- .../asio/asio/detail/io_uring_service.hpp | 2 +- .../asio/detail/io_uring_socket_accept_op.hpp | 2 +- .../detail/io_uring_socket_connect_op.hpp | 2 +- .../asio/detail/io_uring_socket_recv_op.hpp | 2 +- .../detail/io_uring_socket_recvfrom_op.hpp | 2 +- .../detail/io_uring_socket_recvmsg_op.hpp | 2 +- .../asio/detail/io_uring_socket_send_op.hpp | 2 +- .../asio/detail/io_uring_socket_sendto_op.hpp | 2 +- .../asio/detail/io_uring_socket_service.hpp | 2 +- .../detail/io_uring_socket_service_base.hpp | 2 +- .../asio/asio/detail/io_uring_wait_op.hpp | 2 +- .../asio/asio/detail/is_buffer_sequence.hpp | 2 +- thirdparty/asio/asio/detail/is_executor.hpp | 2 +- .../asio/asio/detail/keyword_tss_ptr.hpp | 2 +- .../asio/asio/detail/kqueue_reactor.hpp | 23 +- .../detail/lib_aio_descriptor_read_at_op.hpp | 205 --- .../detail/lib_aio_descriptor_read_op.hpp | 203 --- .../detail/lib_aio_descriptor_service.hpp | 762 ----------- .../detail/lib_aio_descriptor_write_at_op.hpp | 205 --- .../detail/lib_aio_descriptor_write_op.hpp | 202 --- .../asio/asio/detail/lib_aio_file_service.hpp | 270 ---- .../asio/asio/detail/lib_aio_io_operation.hpp | 167 --- .../asio/detail/lib_aio_null_buffers_op.hpp | 132 -- .../asio/detail/local_free_on_block_exit.hpp | 2 +- .../asio/asio/detail/macos_fenced_block.hpp | 2 +- thirdparty/asio/asio/detail/memory.hpp | 20 +- thirdparty/asio/asio/detail/mutex.hpp | 2 +- .../asio/asio/detail/non_const_lvalue.hpp | 2 +- thirdparty/asio/asio/detail/noncopyable.hpp | 2 +- thirdparty/asio/asio/detail/null_event.hpp | 2 +- .../asio/asio/detail/null_fenced_block.hpp | 2 +- thirdparty/asio/asio/detail/null_global.hpp | 2 +- thirdparty/asio/asio/detail/null_mutex.hpp | 2 +- thirdparty/asio/asio/detail/null_reactor.hpp | 2 +- .../asio/asio/detail/null_signal_blocker.hpp | 2 +- .../asio/asio/detail/null_socket_service.hpp | 2 +- .../asio/asio/detail/null_static_mutex.hpp | 2 +- thirdparty/asio/asio/detail/null_thread.hpp | 2 +- thirdparty/asio/asio/detail/null_tss_ptr.hpp | 2 +- thirdparty/asio/asio/detail/object_pool.hpp | 2 +- .../asio/asio/detail/old_win_sdk_compat.hpp | 2 +- thirdparty/asio/asio/detail/op_queue.hpp | 2 +- thirdparty/asio/asio/detail/operation.hpp | 2 +- .../asio/detail/pipe_select_interrupter.hpp | 2 +- thirdparty/asio/asio/detail/pop_options.hpp | 2 +- thirdparty/asio/asio/detail/posix_event.hpp | 2 +- .../asio/asio/detail/posix_fd_set_adapter.hpp | 2 +- thirdparty/asio/asio/detail/posix_global.hpp | 2 +- thirdparty/asio/asio/detail/posix_mutex.hpp | 2 +- .../asio/detail/posix_serial_port_service.hpp | 2 +- .../asio/asio/detail/posix_signal_blocker.hpp | 2 +- .../asio/asio/detail/posix_static_mutex.hpp | 2 +- thirdparty/asio/asio/detail/posix_thread.hpp | 2 +- thirdparty/asio/asio/detail/posix_tss_ptr.hpp | 2 +- thirdparty/asio/asio/detail/push_options.hpp | 2 +- .../detail/reactive_descriptor_service.hpp | 74 +- .../asio/detail/reactive_null_buffers_op.hpp | 34 +- .../asio/detail/reactive_socket_accept_op.hpp | 79 +- .../detail/reactive_socket_connect_op.hpp | 37 +- .../asio/detail/reactive_socket_recv_op.hpp | 36 +- .../detail/reactive_socket_recvfrom_op.hpp | 37 +- .../detail/reactive_socket_recvmsg_op.hpp | 37 +- .../asio/detail/reactive_socket_send_op.hpp | 37 +- .../asio/detail/reactive_socket_sendto_op.hpp | 36 +- .../asio/detail/reactive_socket_service.hpp | 18 +- .../detail/reactive_socket_service_base.hpp | 153 +-- .../asio/asio/detail/reactive_wait_op.hpp | 34 +- thirdparty/asio/asio/detail/reactor.hpp | 2 +- thirdparty/asio/asio/detail/reactor_op.hpp | 2 +- .../asio/asio/detail/reactor_op_queue.hpp | 2 +- .../asio/asio/detail/recycling_allocator.hpp | 2 +- thirdparty/asio/asio/detail/regex_fwd.hpp | 2 +- .../asio/asio/detail/resolve_endpoint_op.hpp | 2 +- thirdparty/asio/asio/detail/resolve_op.hpp | 2 +- .../asio/asio/detail/resolve_query_op.hpp | 2 +- .../asio/asio/detail/resolver_service.hpp | 2 +- .../asio/detail/resolver_service_base.hpp | 2 +- thirdparty/asio/asio/detail/scheduler.hpp | 2 +- .../asio/asio/detail/scheduler_operation.hpp | 2 +- .../asio/asio/detail/scheduler_task.hpp | 2 +- .../asio/detail/scheduler_thread_info.hpp | 2 +- thirdparty/asio/asio/detail/scoped_lock.hpp | 2 +- thirdparty/asio/asio/detail/scoped_ptr.hpp | 2 +- .../asio/asio/detail/select_interrupter.hpp | 2 +- .../asio/asio/detail/select_reactor.hpp | 23 +- .../asio/asio/detail/service_registry.hpp | 2 +- .../asio/asio/detail/signal_blocker.hpp | 2 +- .../asio/asio/detail/signal_handler.hpp | 2 +- thirdparty/asio/asio/detail/signal_init.hpp | 2 +- thirdparty/asio/asio/detail/signal_op.hpp | 2 +- .../asio/asio/detail/signal_set_service.hpp | 2 +- thirdparty/asio/asio/detail/socket_holder.hpp | 2 +- thirdparty/asio/asio/detail/socket_ops.hpp | 2 +- thirdparty/asio/asio/detail/socket_option.hpp | 2 +- .../asio/detail/socket_select_interrupter.hpp | 2 +- thirdparty/asio/asio/detail/socket_types.hpp | 2 +- .../asio/asio/detail/solaris_fenced_block.hpp | 2 +- .../asio/asio/detail/source_location.hpp | 2 +- thirdparty/asio/asio/detail/static_mutex.hpp | 2 +- thirdparty/asio/asio/detail/std_event.hpp | 2 +- .../asio/asio/detail/std_fenced_block.hpp | 2 +- thirdparty/asio/asio/detail/std_global.hpp | 2 +- thirdparty/asio/asio/detail/std_mutex.hpp | 2 +- .../asio/asio/detail/std_static_mutex.hpp | 2 +- thirdparty/asio/asio/detail/std_thread.hpp | 2 +- .../asio/detail/strand_executor_service.hpp | 2 +- .../asio/asio/detail/strand_service.hpp | 2 +- thirdparty/asio/asio/detail/string_view.hpp | 2 +- thirdparty/asio/asio/detail/thread.hpp | 2 +- .../asio/asio/detail/thread_context.hpp | 2 +- thirdparty/asio/asio/detail/thread_group.hpp | 2 +- .../asio/asio/detail/thread_info_base.hpp | 2 +- thirdparty/asio/asio/detail/throw_error.hpp | 2 +- .../asio/asio/detail/throw_exception.hpp | 2 +- thirdparty/asio/asio/detail/timer_queue.hpp | 2 +- .../asio/asio/detail/timer_queue_base.hpp | 2 +- .../asio/asio/detail/timer_queue_ptime.hpp | 2 +- .../asio/asio/detail/timer_queue_set.hpp | 2 +- .../asio/asio/detail/timer_scheduler.hpp | 2 +- .../asio/asio/detail/timer_scheduler_fwd.hpp | 2 +- thirdparty/asio/asio/detail/tss_ptr.hpp | 2 +- thirdparty/asio/asio/detail/type_traits.hpp | 2 +- thirdparty/asio/asio/detail/utility.hpp | 5 +- .../asio/asio/detail/variadic_templates.hpp | 2 +- thirdparty/asio/asio/detail/wait_handler.hpp | 2 +- thirdparty/asio/asio/detail/wait_op.hpp | 2 +- thirdparty/asio/asio/detail/win_event.hpp | 2 +- .../asio/asio/detail/win_fd_set_adapter.hpp | 2 +- .../asio/asio/detail/win_fenced_block.hpp | 2 +- thirdparty/asio/asio/detail/win_global.hpp | 2 +- .../asio/detail/win_iocp_file_service.hpp | 2 +- .../asio/detail/win_iocp_handle_read_op.hpp | 2 +- .../asio/detail/win_iocp_handle_service.hpp | 2 +- .../asio/detail/win_iocp_handle_write_op.hpp | 2 +- .../asio/asio/detail/win_iocp_io_context.hpp | 2 +- .../asio/detail/win_iocp_null_buffers_op.hpp | 2 +- .../asio/asio/detail/win_iocp_operation.hpp | 2 +- .../asio/detail/win_iocp_overlapped_op.hpp | 2 +- .../asio/detail/win_iocp_overlapped_ptr.hpp | 2 +- .../detail/win_iocp_serial_port_service.hpp | 2 +- .../asio/detail/win_iocp_socket_accept_op.hpp | 2 +- .../detail/win_iocp_socket_connect_op.hpp | 2 +- .../asio/detail/win_iocp_socket_recv_op.hpp | 2 +- .../detail/win_iocp_socket_recvfrom_op.hpp | 2 +- .../detail/win_iocp_socket_recvmsg_op.hpp | 2 +- .../asio/detail/win_iocp_socket_send_op.hpp | 2 +- .../asio/detail/win_iocp_socket_service.hpp | 2 +- .../detail/win_iocp_socket_service_base.hpp | 2 +- .../asio/asio/detail/win_iocp_thread_info.hpp | 2 +- .../asio/asio/detail/win_iocp_wait_op.hpp | 2 +- thirdparty/asio/asio/detail/win_mutex.hpp | 2 +- .../asio/detail/win_object_handle_service.hpp | 2 +- .../asio/asio/detail/win_static_mutex.hpp | 2 +- thirdparty/asio/asio/detail/win_thread.hpp | 2 +- thirdparty/asio/asio/detail/win_tss_ptr.hpp | 2 +- thirdparty/asio/asio/detail/winapp_thread.hpp | 2 +- thirdparty/asio/asio/detail/wince_thread.hpp | 2 +- .../asio/asio/detail/winrt_async_manager.hpp | 2 +- .../asio/asio/detail/winrt_async_op.hpp | 2 +- .../asio/asio/detail/winrt_resolve_op.hpp | 2 +- .../asio/detail/winrt_resolver_service.hpp | 2 +- .../asio/detail/winrt_socket_connect_op.hpp | 2 +- .../asio/asio/detail/winrt_socket_recv_op.hpp | 2 +- .../asio/asio/detail/winrt_socket_send_op.hpp | 2 +- .../asio/detail/winrt_ssocket_service.hpp | 2 +- .../detail/winrt_ssocket_service_base.hpp | 2 +- .../asio/detail/winrt_timer_scheduler.hpp | 2 +- thirdparty/asio/asio/detail/winrt_utils.hpp | 2 +- thirdparty/asio/asio/detail/winsock_init.hpp | 2 +- .../asio/asio/detail/work_dispatcher.hpp | 12 +- .../asio/asio/detail/wrapped_handler.hpp | 2 +- thirdparty/asio/asio/dispatch.hpp | 49 +- thirdparty/asio/asio/error.hpp | 2 +- thirdparty/asio/asio/error_code.hpp | 2 +- thirdparty/asio/asio/execution.hpp | 2 +- thirdparty/asio/asio/execution/allocator.hpp | 27 +- .../asio/asio/execution/any_executor.hpp | 591 +++------ .../asio/asio/execution/bad_executor.hpp | 2 +- thirdparty/asio/asio/execution/blocking.hpp | 67 +- .../asio/execution/blocking_adaptation.hpp | 59 +- .../asio/asio/execution/bulk_execute.hpp | 7 +- .../asio/asio/execution/bulk_guarantee.hpp | 47 +- thirdparty/asio/asio/execution/connect.hpp | 7 +- thirdparty/asio/asio/execution/context.hpp | 17 +- thirdparty/asio/asio/execution/context_as.hpp | 17 +- .../asio/execution/detail/as_invocable.hpp | 2 +- .../asio/execution/detail/as_operation.hpp | 6 +- .../asio/execution/detail/as_receiver.hpp | 2 +- .../asio/execution/detail/bulk_sender.hpp | 2 +- .../asio/execution/detail/submit_receiver.hpp | 2 +- .../asio/execution/detail/void_receiver.hpp | 2 +- thirdparty/asio/asio/execution/execute.hpp | 13 +- thirdparty/asio/asio/execution/executor.hpp | 14 +- .../asio/asio/execution/impl/bad_executor.ipp | 2 +- .../impl/receiver_invocation_error.ipp | 2 +- .../asio/execution/invocable_archetype.hpp | 2 +- thirdparty/asio/asio/execution/mapping.hpp | 62 +- thirdparty/asio/asio/execution/occupancy.hpp | 17 +- .../asio/asio/execution/operation_state.hpp | 7 +- .../asio/asio/execution/outstanding_work.hpp | 47 +- .../asio/asio/execution/prefer_only.hpp | 2 +- thirdparty/asio/asio/execution/receiver.hpp | 7 +- .../execution/receiver_invocation_error.hpp | 2 +- .../asio/asio/execution/relationship.hpp | 47 +- thirdparty/asio/asio/execution/schedule.hpp | 7 +- thirdparty/asio/asio/execution/scheduler.hpp | 7 +- thirdparty/asio/asio/execution/sender.hpp | 7 +- thirdparty/asio/asio/execution/set_done.hpp | 7 +- thirdparty/asio/asio/execution/set_error.hpp | 7 +- thirdparty/asio/asio/execution/set_value.hpp | 7 +- thirdparty/asio/asio/execution/start.hpp | 7 +- thirdparty/asio/asio/execution/submit.hpp | 7 +- thirdparty/asio/asio/execution_context.hpp | 2 +- thirdparty/asio/asio/executor.hpp | 2 +- thirdparty/asio/asio/executor_work_guard.hpp | 17 +- thirdparty/asio/asio/experimental/append.hpp | 2 +- .../asio/asio/experimental/as_single.hpp | 2 +- .../asio/asio/experimental/as_tuple.hpp | 2 +- .../asio/experimental/awaitable_operators.hpp | 2 +- .../asio/asio/experimental/basic_channel.hpp | 8 +- .../experimental/basic_concurrent_channel.hpp | 8 +- .../experimental/cancellation_condition.hpp | 2 +- thirdparty/asio/asio/experimental/channel.hpp | 2 +- .../asio/asio/experimental/channel_error.hpp | 2 +- .../asio/asio/experimental/channel_traits.hpp | 72 +- .../asio/asio/experimental/co_composed.hpp | 144 --- .../asio/asio/experimental/co_spawn.hpp | 2 +- .../asio/experimental/concurrent_channel.hpp | 2 +- thirdparty/asio/asio/experimental/coro.hpp | 42 +- .../asio/asio/experimental/coro_traits.hpp | 2 +- .../asio/asio/experimental/deferred.hpp | 2 +- .../experimental/detail/channel_handler.hpp | 18 +- .../experimental/detail/channel_message.hpp | 2 +- .../experimental/detail/channel_operation.hpp | 9 +- .../experimental/detail/channel_payload.hpp | 2 +- .../detail/channel_receive_op.hpp | 2 +- .../detail/channel_send_functions.hpp | 2 +- .../experimental/detail/channel_send_op.hpp | 2 +- .../experimental/detail/channel_service.hpp | 182 +-- .../detail/completion_handler_erasure.hpp | 194 +++ .../detail/coro_completion_handler.hpp | 169 --- .../detail/coro_promise_allocator.hpp | 157 +-- .../experimental/detail/has_signature.hpp | 2 +- .../detail/impl/channel_service.hpp | 6 +- .../experimental/detail/partial_promise.hpp | 113 +- .../asio/asio/experimental/impl/as_single.hpp | 18 +- .../asio/experimental/impl/channel_error.ipp | 2 +- .../asio/experimental/impl/co_composed.hpp | 1132 ----------------- .../asio/asio/experimental/impl/coro.hpp | 238 ++-- .../asio/experimental/impl/parallel_group.hpp | 382 +----- .../asio/asio/experimental/impl/promise.hpp | 199 +-- .../asio/asio/experimental/impl/use_coro.hpp | 354 +++--- .../asio/experimental/impl/use_promise.hpp | 66 - .../asio/asio/experimental/parallel_group.hpp | 258 +--- thirdparty/asio/asio/experimental/prepend.hpp | 2 +- thirdparty/asio/asio/experimental/promise.hpp | 158 +-- .../asio/asio/experimental/use_coro.hpp | 56 +- .../asio/asio/experimental/use_promise.hpp | 111 -- thirdparty/asio/asio/file_base.hpp | 3 +- .../asio/asio/generic/basic_endpoint.hpp | 2 +- .../asio/asio/generic/datagram_protocol.hpp | 2 +- .../asio/asio/generic/detail/endpoint.hpp | 2 +- .../asio/generic/detail/impl/endpoint.ipp | 2 +- thirdparty/asio/asio/generic/raw_protocol.hpp | 2 +- .../asio/asio/generic/seq_packet_protocol.hpp | 2 +- .../asio/asio/generic/stream_protocol.hpp | 2 +- thirdparty/asio/asio/handler_alloc_hook.hpp | 2 +- .../asio/asio/handler_continuation_hook.hpp | 2 +- thirdparty/asio/asio/handler_invoke_hook.hpp | 2 +- .../asio/asio/high_resolution_timer.hpp | 2 +- .../asio/impl/any_completion_executor.ipp | 130 -- thirdparty/asio/asio/impl/any_io_executor.ipp | 14 +- thirdparty/asio/asio/impl/append.hpp | 17 +- thirdparty/asio/asio/impl/as_tuple.hpp | 17 +- thirdparty/asio/asio/impl/awaitable.hpp | 6 +- .../asio/asio/impl/buffered_read_stream.hpp | 33 +- .../asio/asio/impl/buffered_write_stream.hpp | 33 +- .../asio/asio/impl/cancellation_signal.ipp | 2 +- thirdparty/asio/asio/impl/co_spawn.hpp | 81 +- thirdparty/asio/asio/impl/connect.hpp | 36 +- thirdparty/asio/asio/impl/connect_pipe.hpp | 2 +- thirdparty/asio/asio/impl/connect_pipe.ipp | 2 +- thirdparty/asio/asio/impl/consign.hpp | 202 --- .../initiate_defer.hpp => impl/defer.hpp} | 86 +- thirdparty/asio/asio/impl/deferred.hpp | 18 +- thirdparty/asio/asio/impl/detached.hpp | 2 +- .../dispatch.hpp} | 86 +- thirdparty/asio/asio/impl/error.ipp | 2 +- thirdparty/asio/asio/impl/error_code.ipp | 2 +- .../asio/asio/impl/execution_context.hpp | 2 +- .../asio/asio/impl/execution_context.ipp | 2 +- thirdparty/asio/asio/impl/executor.hpp | 2 +- thirdparty/asio/asio/impl/executor.ipp | 2 +- .../asio/asio/impl/handler_alloc_hook.ipp | 4 +- thirdparty/asio/asio/impl/io_context.hpp | 2 +- thirdparty/asio/asio/impl/io_context.ipp | 3 +- .../asio/asio/impl/multiple_exceptions.ipp | 2 +- .../initiate_post.hpp => impl/post.hpp} | 86 +- thirdparty/asio/asio/impl/prepend.hpp | 17 +- thirdparty/asio/asio/impl/read.hpp | 51 +- thirdparty/asio/asio/impl/read_at.hpp | 35 +- thirdparty/asio/asio/impl/read_until.hpp | 130 +- thirdparty/asio/asio/impl/redirect_error.hpp | 17 +- .../asio/asio/impl/serial_port_base.hpp | 2 +- .../asio/asio/impl/serial_port_base.ipp | 2 +- thirdparty/asio/asio/impl/spawn.hpp | 87 +- thirdparty/asio/asio/impl/src.hpp | 3 +- thirdparty/asio/asio/impl/system_context.hpp | 2 +- thirdparty/asio/asio/impl/system_context.ipp | 2 +- thirdparty/asio/asio/impl/system_executor.hpp | 2 +- thirdparty/asio/asio/impl/thread_pool.hpp | 2 +- thirdparty/asio/asio/impl/thread_pool.ipp | 9 +- thirdparty/asio/asio/impl/use_awaitable.hpp | 2 +- thirdparty/asio/asio/impl/use_future.hpp | 27 +- thirdparty/asio/asio/impl/write.hpp | 70 +- thirdparty/asio/asio/impl/write_at.hpp | 35 +- thirdparty/asio/asio/io_context.hpp | 15 +- thirdparty/asio/asio/io_context_strand.hpp | 2 +- thirdparty/asio/asio/io_service.hpp | 2 +- thirdparty/asio/asio/io_service_strand.hpp | 2 +- thirdparty/asio/asio/ip/address.hpp | 2 +- thirdparty/asio/asio/ip/address_v4.hpp | 2 +- .../asio/asio/ip/address_v4_iterator.hpp | 2 +- thirdparty/asio/asio/ip/address_v4_range.hpp | 2 +- thirdparty/asio/asio/ip/address_v6.hpp | 2 +- .../asio/asio/ip/address_v6_iterator.hpp | 2 +- thirdparty/asio/asio/ip/address_v6_range.hpp | 2 +- thirdparty/asio/asio/ip/bad_address_cast.hpp | 2 +- thirdparty/asio/asio/ip/basic_endpoint.hpp | 2 +- thirdparty/asio/asio/ip/basic_resolver.hpp | 2 +- .../asio/asio/ip/basic_resolver_entry.hpp | 2 +- .../asio/asio/ip/basic_resolver_iterator.hpp | 2 +- .../asio/asio/ip/basic_resolver_query.hpp | 2 +- .../asio/asio/ip/basic_resolver_results.hpp | 2 +- thirdparty/asio/asio/ip/detail/endpoint.hpp | 2 +- .../asio/asio/ip/detail/impl/endpoint.ipp | 2 +- .../asio/asio/ip/detail/socket_option.hpp | 2 +- thirdparty/asio/asio/ip/host_name.hpp | 2 +- thirdparty/asio/asio/ip/icmp.hpp | 2 +- thirdparty/asio/asio/ip/impl/address.hpp | 2 +- thirdparty/asio/asio/ip/impl/address.ipp | 2 +- thirdparty/asio/asio/ip/impl/address_v4.hpp | 2 +- thirdparty/asio/asio/ip/impl/address_v4.ipp | 2 +- thirdparty/asio/asio/ip/impl/address_v6.hpp | 2 +- thirdparty/asio/asio/ip/impl/address_v6.ipp | 2 +- .../asio/asio/ip/impl/basic_endpoint.hpp | 2 +- thirdparty/asio/asio/ip/impl/host_name.ipp | 2 +- thirdparty/asio/asio/ip/impl/network_v4.hpp | 2 +- thirdparty/asio/asio/ip/impl/network_v4.ipp | 6 +- thirdparty/asio/asio/ip/impl/network_v6.hpp | 2 +- thirdparty/asio/asio/ip/impl/network_v6.ipp | 6 +- thirdparty/asio/asio/ip/multicast.hpp | 2 +- thirdparty/asio/asio/ip/network_v4.hpp | 2 +- thirdparty/asio/asio/ip/network_v6.hpp | 2 +- thirdparty/asio/asio/ip/resolver_base.hpp | 2 +- .../asio/asio/ip/resolver_query_base.hpp | 2 +- thirdparty/asio/asio/ip/tcp.hpp | 2 +- thirdparty/asio/asio/ip/udp.hpp | 2 +- thirdparty/asio/asio/ip/unicast.hpp | 2 +- thirdparty/asio/asio/ip/v6_only.hpp | 2 +- .../asio/asio/is_applicable_property.hpp | 2 +- .../asio/asio/is_contiguous_iterator.hpp | 2 +- thirdparty/asio/asio/is_executor.hpp | 2 +- thirdparty/asio/asio/is_read_buffered.hpp | 2 +- thirdparty/asio/asio/is_write_buffered.hpp | 2 +- thirdparty/asio/asio/local/basic_endpoint.hpp | 2 +- thirdparty/asio/asio/local/connect_pair.hpp | 2 +- .../asio/asio/local/datagram_protocol.hpp | 2 +- .../asio/asio/local/detail/endpoint.hpp | 2 +- .../asio/asio/local/detail/impl/endpoint.ipp | 2 +- .../asio/asio/local/seq_packet_protocol.hpp | 84 -- .../asio/asio/local/stream_protocol.hpp | 2 +- thirdparty/asio/asio/multiple_exceptions.hpp | 2 +- thirdparty/asio/asio/packaged_task.hpp | 2 +- thirdparty/asio/asio/placeholders.hpp | 2 +- .../asio/asio/posix/basic_descriptor.hpp | 6 +- .../asio/posix/basic_stream_descriptor.hpp | 6 +- thirdparty/asio/asio/posix/descriptor.hpp | 2 +- .../asio/asio/posix/descriptor_base.hpp | 2 +- .../asio/asio/posix/stream_descriptor.hpp | 2 +- thirdparty/asio/asio/post.hpp | 66 +- thirdparty/asio/asio/prefer.hpp | 2 +- thirdparty/asio/asio/prepend.hpp | 2 +- thirdparty/asio/asio/query.hpp | 2 +- thirdparty/asio/asio/random_access_file.hpp | 2 +- thirdparty/asio/asio/read.hpp | 2 +- thirdparty/asio/asio/read_at.hpp | 2 +- thirdparty/asio/asio/read_until.hpp | 2 +- thirdparty/asio/asio/readable_pipe.hpp | 2 +- thirdparty/asio/asio/recycling_allocator.hpp | 2 +- thirdparty/asio/asio/redirect_error.hpp | 2 +- thirdparty/asio/asio/registered_buffer.hpp | 2 +- thirdparty/asio/asio/require.hpp | 2 +- thirdparty/asio/asio/require_concept.hpp | 2 +- thirdparty/asio/asio/serial_port.hpp | 2 +- thirdparty/asio/asio/serial_port_base.hpp | 2 +- thirdparty/asio/asio/signal_set.hpp | 2 +- thirdparty/asio/asio/socket_base.hpp | 2 +- thirdparty/asio/asio/spawn.hpp | 6 +- thirdparty/asio/asio/ssl.hpp | 2 +- thirdparty/asio/asio/ssl/context.hpp | 2 +- thirdparty/asio/asio/ssl/context_base.hpp | 2 +- .../asio/ssl/detail/buffered_handshake_op.hpp | 2 +- thirdparty/asio/asio/ssl/detail/engine.hpp | 2 +- .../asio/asio/ssl/detail/handshake_op.hpp | 2 +- .../asio/asio/ssl/detail/impl/engine.ipp | 2 +- .../asio/ssl/detail/impl/openssl_init.ipp | 2 +- thirdparty/asio/asio/ssl/detail/io.hpp | 18 +- .../asio/asio/ssl/detail/openssl_init.hpp | 2 +- .../asio/asio/ssl/detail/openssl_types.hpp | 2 +- .../asio/ssl/detail/password_callback.hpp | 2 +- thirdparty/asio/asio/ssl/detail/read_op.hpp | 2 +- .../asio/asio/ssl/detail/shutdown_op.hpp | 2 +- .../asio/asio/ssl/detail/stream_core.hpp | 2 +- .../asio/asio/ssl/detail/verify_callback.hpp | 2 +- thirdparty/asio/asio/ssl/detail/write_op.hpp | 2 +- thirdparty/asio/asio/ssl/error.hpp | 2 +- .../asio/asio/ssl/host_name_verification.hpp | 2 +- thirdparty/asio/asio/ssl/impl/context.hpp | 2 +- thirdparty/asio/asio/ssl/impl/context.ipp | 2 +- thirdparty/asio/asio/ssl/impl/error.ipp | 2 +- .../asio/ssl/impl/host_name_verification.ipp | 2 +- .../asio/ssl/impl/rfc2818_verification.ipp | 2 +- thirdparty/asio/asio/ssl/impl/src.hpp | 2 +- .../asio/asio/ssl/rfc2818_verification.hpp | 2 +- thirdparty/asio/asio/ssl/stream.hpp | 2 +- thirdparty/asio/asio/ssl/stream_base.hpp | 2 +- thirdparty/asio/asio/ssl/verify_context.hpp | 2 +- thirdparty/asio/asio/ssl/verify_mode.hpp | 2 +- thirdparty/asio/asio/static_thread_pool.hpp | 2 +- thirdparty/asio/asio/steady_timer.hpp | 2 +- thirdparty/asio/asio/strand.hpp | 20 +- thirdparty/asio/asio/stream_file.hpp | 2 +- thirdparty/asio/asio/streambuf.hpp | 2 +- thirdparty/asio/asio/system_context.hpp | 2 +- thirdparty/asio/asio/system_error.hpp | 2 +- thirdparty/asio/asio/system_executor.hpp | 15 +- thirdparty/asio/asio/system_timer.hpp | 2 +- thirdparty/asio/asio/this_coro.hpp | 2 +- thirdparty/asio/asio/thread.hpp | 2 +- thirdparty/asio/asio/thread_pool.hpp | 43 +- thirdparty/asio/asio/time_traits.hpp | 2 +- .../asio/asio/traits/bulk_execute_free.hpp | 2 +- .../asio/asio/traits/bulk_execute_member.hpp | 2 +- thirdparty/asio/asio/traits/connect_free.hpp | 2 +- .../asio/asio/traits/connect_member.hpp | 2 +- .../asio/asio/traits/equality_comparable.hpp | 2 +- thirdparty/asio/asio/traits/execute_free.hpp | 2 +- .../asio/asio/traits/execute_member.hpp | 2 +- thirdparty/asio/asio/traits/prefer_free.hpp | 2 +- thirdparty/asio/asio/traits/prefer_member.hpp | 2 +- thirdparty/asio/asio/traits/query_free.hpp | 2 +- thirdparty/asio/asio/traits/query_member.hpp | 2 +- .../traits/query_static_constexpr_member.hpp | 2 +- .../asio/asio/traits/require_concept_free.hpp | 2 +- .../asio/traits/require_concept_member.hpp | 2 +- thirdparty/asio/asio/traits/require_free.hpp | 2 +- .../asio/asio/traits/require_member.hpp | 2 +- thirdparty/asio/asio/traits/schedule_free.hpp | 2 +- .../asio/asio/traits/schedule_member.hpp | 2 +- thirdparty/asio/asio/traits/set_done_free.hpp | 2 +- .../asio/asio/traits/set_done_member.hpp | 2 +- .../asio/asio/traits/set_error_free.hpp | 2 +- .../asio/asio/traits/set_error_member.hpp | 2 +- .../asio/asio/traits/set_value_free.hpp | 2 +- .../asio/asio/traits/set_value_member.hpp | 2 +- thirdparty/asio/asio/traits/start_free.hpp | 2 +- thirdparty/asio/asio/traits/start_member.hpp | 2 +- thirdparty/asio/asio/traits/static_query.hpp | 2 +- .../asio/asio/traits/static_require.hpp | 2 +- .../asio/traits/static_require_concept.hpp | 2 +- thirdparty/asio/asio/traits/submit_free.hpp | 2 +- thirdparty/asio/asio/traits/submit_member.hpp | 2 +- thirdparty/asio/asio/ts/buffer.hpp | 2 +- thirdparty/asio/asio/ts/executor.hpp | 2 +- thirdparty/asio/asio/ts/internet.hpp | 2 +- thirdparty/asio/asio/ts/io_context.hpp | 2 +- thirdparty/asio/asio/ts/net.hpp | 2 +- thirdparty/asio/asio/ts/netfwd.hpp | 2 +- thirdparty/asio/asio/ts/socket.hpp | 2 +- thirdparty/asio/asio/ts/timer.hpp | 2 +- thirdparty/asio/asio/unyield.hpp | 2 +- thirdparty/asio/asio/use_awaitable.hpp | 2 +- thirdparty/asio/asio/use_future.hpp | 2 +- thirdparty/asio/asio/uses_executor.hpp | 2 +- thirdparty/asio/asio/version.hpp | 4 +- thirdparty/asio/asio/wait_traits.hpp | 2 +- .../asio/asio/windows/basic_object_handle.hpp | 6 +- .../asio/windows/basic_overlapped_handle.hpp | 4 +- .../windows/basic_random_access_handle.hpp | 6 +- .../asio/asio/windows/basic_stream_handle.hpp | 6 +- .../asio/asio/windows/object_handle.hpp | 2 +- .../asio/asio/windows/overlapped_handle.hpp | 2 +- .../asio/asio/windows/overlapped_ptr.hpp | 2 +- .../asio/windows/random_access_handle.hpp | 2 +- .../asio/asio/windows/stream_handle.hpp | 2 +- thirdparty/asio/asio/writable_pipe.hpp | 2 +- thirdparty/asio/asio/write.hpp | 2 +- thirdparty/asio/asio/write_at.hpp | 2 +- thirdparty/asio/asio/yield.hpp | 2 +- 691 files changed, 3713 insertions(+), 12644 deletions(-) create mode 100644 include/coro_io/coro_file.hpp create mode 100644 src/coro_file/CMakeLists.txt create mode 100644 src/coro_file/examples/CMakeLists.txt create mode 100644 src/coro_file/examples/main.cpp create mode 100644 src/coro_file/tests/CMakeLists.txt create mode 100644 src/coro_file/tests/main.cpp create mode 100644 src/coro_file/tests/test_corofile.cpp delete mode 100644 thirdparty/asio/asio/any_completion_executor.hpp delete mode 100644 thirdparty/asio/asio/any_completion_handler.hpp delete mode 100644 thirdparty/asio/asio/associated_immediate_executor.hpp delete mode 100644 thirdparty/asio/asio/bind_immediate_executor.hpp delete mode 100644 thirdparty/asio/asio/consign.hpp delete mode 100644 thirdparty/asio/asio/detail/composed_work.hpp delete mode 100644 thirdparty/asio/asio/detail/impl/lib_aio_descriptor_service.ipp delete mode 100644 thirdparty/asio/asio/detail/impl/lib_aio_file_service.ipp delete mode 100644 thirdparty/asio/asio/detail/lib_aio_descriptor_read_at_op.hpp delete mode 100644 thirdparty/asio/asio/detail/lib_aio_descriptor_read_op.hpp delete mode 100644 thirdparty/asio/asio/detail/lib_aio_descriptor_service.hpp delete mode 100644 thirdparty/asio/asio/detail/lib_aio_descriptor_write_at_op.hpp delete mode 100644 thirdparty/asio/asio/detail/lib_aio_descriptor_write_op.hpp delete mode 100644 thirdparty/asio/asio/detail/lib_aio_file_service.hpp delete mode 100644 thirdparty/asio/asio/detail/lib_aio_io_operation.hpp delete mode 100644 thirdparty/asio/asio/detail/lib_aio_null_buffers_op.hpp delete mode 100644 thirdparty/asio/asio/experimental/co_composed.hpp create mode 100644 thirdparty/asio/asio/experimental/detail/completion_handler_erasure.hpp delete mode 100644 thirdparty/asio/asio/experimental/detail/coro_completion_handler.hpp delete mode 100644 thirdparty/asio/asio/experimental/impl/co_composed.hpp delete mode 100644 thirdparty/asio/asio/experimental/impl/use_promise.hpp delete mode 100644 thirdparty/asio/asio/experimental/use_promise.hpp delete mode 100644 thirdparty/asio/asio/impl/any_completion_executor.ipp delete mode 100644 thirdparty/asio/asio/impl/consign.hpp rename thirdparty/asio/asio/{detail/initiate_defer.hpp => impl/defer.hpp} (77%) rename thirdparty/asio/asio/{detail/initiate_dispatch.hpp => impl/dispatch.hpp} (72%) rename thirdparty/asio/asio/{detail/initiate_post.hpp => impl/post.hpp} (77%) delete mode 100644 thirdparty/asio/asio/local/seq_packet_protocol.hpp diff --git a/cmake/module.cmake b/cmake/module.cmake index 3911287b8..3a54a2259 100644 --- a/cmake/module.cmake +++ b/cmake/module.cmake @@ -1,5 +1,5 @@ # module-list -set(yLT_ALL_PROJECTS "struct_pack;struct_pb;struct_json;struct_xml;coro_rpc;easylog;coro_http") +set(yLT_ALL_PROJECTS "struct_pack;struct_pb;struct_json;struct_xml;coro_rpc;easylog;coro_http;coro_file") # separate option(Build_ylt_struct_pack "Build struct_pack" ON) option(Build_ylt_struct_pb "Build struct_pb" ON) @@ -8,6 +8,7 @@ option(Build_ylt_struct_xml "Build struct_xml" ON) option(Build_ylt_coro_rpc "Build coro_rpc" ON) option(Build_ylt_easylog "Build easylog" ON) option(Build_ylt_coro_http "Build coro_http" ON) +option(Build_ylt_coro_file "Build coro_file" ON) foreach (proj ${yLT_ALL_PROJECTS}) set(build_proj "Build_ylt_${proj}") diff --git a/include/coro_io/coro_file.hpp b/include/coro_io/coro_file.hpp new file mode 100644 index 000000000..25755c149 --- /dev/null +++ b/include/coro_io/coro_file.hpp @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2023, Alibaba Group Holding Limited; + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once +#include +#include + +#include "async_simple/Promise.h" +#include "async_simple/Traits.h" +#include "async_simple/coro/FutureAwaiter.h" +#if defined(ENABLE_FILE_IO_URING) +#include +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "asio/error.hpp" +#include "async_simple/coro/Lazy.h" +#include "coro_io.hpp" + +namespace ylt { +#if defined(ENABLE_FILE_IO_URING) +inline asio::file_base::flags default_flags() { + return asio::stream_file::read_write | asio::stream_file::append | + asio::stream_file::create; +} +#endif + +enum class open_mode { read, write }; + +class coro_file { + public: +#if defined(ENABLE_FILE_IO_URING) + coro_file(asio::io_context::executor_type executor, + const std::string& filepath, open_mode flags = open_mode::read) { + try { + stream_file_ = std::make_unique(executor); + } catch (std::exception& ex) { + std::cout << ex.what() << "\n"; + return; + } + + std::error_code ec; + stream_file_->open(filepath, default_flags(), ec); + if (ec) { + std::cout << ec.message() << "\n"; + } + } +#else + + coro_file(asio::io_context::executor_type executor, + const std::string& filepath, open_mode flags = open_mode::read) + : executor_wrapper_(executor) { + std::ios::openmode open_flags = flags == open_mode::read + ? std::ios::binary | std::ios::in + : std::ios::out | std::ios::app; + stream_file_ = std::make_unique(filepath, open_flags); + if (!stream_file_->is_open()) { + std::cout << "open file " << filepath << " failed " + << "\n"; + stream_file_.reset(); + } + } +#endif + + bool is_open() { +#if defined(ENABLE_FILE_IO_URING) + return stream_file_ && stream_file_->is_open(); +#else + return stream_file_ && stream_file_->is_open(); +#endif + } + + bool eof() { return eof_; } + + void close() { stream_file_.reset(); } + +#if defined(ENABLE_FILE_IO_URING) + async_simple::coro::Lazy> async_read( + char* data, size_t size) { + size_t left_size = size; + size_t offset = 0; + size_t read_total = 0; + while (left_size) { + auto [ec, read_size] = co_await coro_io::async_read_some( + *stream_file_, asio::buffer(data + offset, size - offset)); + if (ec) { + if (ec == asio::error::eof) { + eof_ = true; + co_return std::make_pair(std::error_code{}, read_total); + } + + co_return std::make_pair(ec, 0); + } + + if (read_size > size) { + // if read_size is very large, it means the size if negative, and there + // is an error occurred. + co_return std::make_pair( + std::make_error_code(std::errc::invalid_argument), 0); + } + + read_total += read_size; + + left_size -= read_size; + offset += read_size; + seek_offset_ += read_size; + std::error_code seek_ec; + stream_file_->seek(seek_offset_, asio::file_base::seek_basis::seek_set, + seek_ec); + if (seek_ec) { + co_return std::make_pair(std::make_error_code(std::errc::invalid_seek), + 0); + } + } + + co_return std::make_pair(std::error_code{}, read_total); + } + + async_simple::coro::Lazy async_write(const char* data, + size_t size) { + size_t left_size = size; + size_t offset = 0; + while (left_size) { + auto [ec, write_size] = co_await coro_io::async_write_some( + *stream_file_, asio::buffer(data, size)); + + if (ec) { + co_return ec; + } + + left_size -= write_size; + if (left_size == 0) { + co_return ec; + } + offset += write_size; + std::error_code seek_ec; + stream_file_->seek(offset, asio::file_base::seek_basis::seek_set, + seek_ec); + if (seek_ec) { + co_return seek_ec; + } + } + + co_return std::error_code{}; + } +#else + async_simple::coro::Lazy> async_read( + char* data, size_t size) { + async_simple::Promise> promise; + async_read_impl(data, size) + .via(&executor_wrapper_) + .start([&promise](auto&& t) { + if (t.available()) { + promise.setValue(t.value()); + } + else { + promise.setValue(std::make_pair( + std::make_error_code(std::errc::io_error), size_t(0))); + } + }); + + co_return co_await promise.getFuture(); + } + + async_simple::coro::Lazy async_write(const char* data, + size_t size) { + async_simple::Promise promise; + async_write_impl(data, size) + .via(&executor_wrapper_) + .start([&promise](auto&& t) { + if (t.available()) { + promise.setValue(t.value()); + } + else { + promise.setValue(std::make_error_code(std::errc::io_error)); + } + }); + + co_return co_await promise.getFuture(); + } + + private: + async_simple::coro::Lazy> async_read_impl( + char* data, size_t size) { + stream_file_->read(data, size); + size_t read_size = stream_file_->gcount(); + if (!stream_file_ && read_size == 0) { + co_return std::make_pair(std::make_error_code(std::errc::io_error), 0); + } + eof_ = stream_file_->eof(); + co_return std::make_pair(std::error_code{}, read_size); + } + + async_simple::coro::Lazy async_write_impl(const char* data, + size_t size) { + stream_file_->write(data, size); + stream_file_->flush(); + co_return std::error_code{}; + } +#endif + + private: +#if defined(ENABLE_FILE_IO_URING) + std::unique_ptr stream_file_; +#else + std::unique_ptr stream_file_; + coro_io::ExecutorWrapper executor_wrapper_; +#endif + size_t seek_offset_ = 0; + bool eof_ = false; +}; +} // namespace ylt \ No newline at end of file diff --git a/include/coro_io/coro_io.hpp b/include/coro_io/coro_io.hpp index a59f28e28..1f831a325 100644 --- a/include/coro_io/coro_io.hpp +++ b/include/coro_io/coro_io.hpp @@ -182,6 +182,17 @@ inline async_simple::coro::Lazy> async_write( }); } +template +inline async_simple::coro::Lazy> +async_write_some(Socket &socket, AsioBuffer &&buffer) noexcept { + callback_awaitor> awaitor; + co_return co_await awaitor.await_resume([&](auto handler) { + socket.async_write_some(buffer, [&, handler](const auto &ec, auto size) { + handler.set_value_then_resume(ec, size); + }); + }); +} + template inline async_simple::coro::Lazy async_connect( executor_t *executor, asio::ip::tcp::socket &socket, diff --git a/src/coro_file/CMakeLists.txt b/src/coro_file/CMakeLists.txt new file mode 100644 index 000000000..e69de29bb diff --git a/src/coro_file/examples/CMakeLists.txt b/src/coro_file/examples/CMakeLists.txt new file mode 100644 index 000000000..5b16525be --- /dev/null +++ b/src/coro_file/examples/CMakeLists.txt @@ -0,0 +1,25 @@ +option(ENABLE_FILE_IO_URING "enable io_uring" OFF) +if(ENABLE_FILE_IO_URING) + message(STATUS "enable io_uring") + add_definitions(-DENABLE_FILE_IO_URING) + add_definitions(-DASIO_HAS_FILE) + add_definitions(-DASIO_HAS_IO_URING) +endif() + +if (UNIX) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") +endif() + +## manual import +include_directories(${yaLanTingLibs_SOURCE_DIR}/thirdparty/asio) +include_directories(${yaLanTingLibs_SOURCE_DIR}/thirdparty/async_simple) + +add_executable(coro_file_example + main.cpp + ) + +if(ENABLE_FILE_IO_URING) +if (UNIX) + target_link_libraries(coro_file_example -luring) +endif() +endif() diff --git a/src/coro_file/examples/main.cpp b/src/coro_file/examples/main.cpp new file mode 100644 index 000000000..91504bfdb --- /dev/null +++ b/src/coro_file/examples/main.cpp @@ -0,0 +1,209 @@ +#include +#include +#include +#include +#include +#include + +#include "asio/io_context.hpp" +#include "async_simple/coro/SyncAwait.h" +#include "coro_io/coro_file.hpp" +#include "coro_io/coro_io.hpp" +#include "coro_io/io_context_pool.hpp" + +void create_temp_file(std::string filename, size_t size) { + std::ofstream file(filename, std::ios::binary); + file.exceptions(std::ios_base::failbit | std::ios_base::badbit); + + if (!file) { + std::cout << "create file failed\n"; + return; + } + + if (size == 0) { + return; + } + + { + std::string str(size, 'a'); + file.write(str.data(), str.size()); + } + { + std::string str(size, 'b'); + file.write(str.data(), str.size()); + } + { + std::string str(42, 'c'); + file.write(str.data(), str.size()); + } + + file.flush(); // can throw +} + +void test_read_file() { + std::string filename = "test1.txt"; + create_temp_file("test1.txt", 1024); + asio::io_context ioc; + auto work = std::make_unique(ioc); + std::thread thd([&ioc] { + ioc.run(); + }); + + ylt::coro_file file(ioc.get_executor(), filename); + bool r = file.is_open(); + if (!file.is_open()) { + return; + } + + char buf[1024]{}; + + while (!file.eof()) { + auto [ec, read_size] = + async_simple::coro::syncAwait(file.async_read(buf, 1024)); + if (ec) { + std::cout << ec.message() << "\n"; + break; + } + + std::cout << read_size << "\n"; + std::cout << std::string_view(buf, read_size) << "\n"; + } + + work.reset(); + thd.join(); +} + +void test_write_and_read_file() { + std::string filename = "test.txt"; + create_temp_file(filename, 0); + + asio::io_context ioc; + auto work = std::make_unique(ioc); + std::thread thd([&ioc] { + ioc.run(); + }); + + ylt::coro_file file(ioc.get_executor(), filename); + bool r = file.is_open(); + if (!file.is_open()) { + return; + } + + std::string str = "test async write"; + + auto ec = + async_simple::coro::syncAwait(file.async_write(str.data(), str.size())); + if (ec) { + std::cout << ec.message() << "\n"; + } + + std::string str1 = "another test async write"; + ec = + async_simple::coro::syncAwait(file.async_write(str1.data(), str1.size())); + if (ec) { + std::cout << ec.message() << "\n"; + } + + ylt::coro_file file1(ioc.get_executor(), filename); + r = file1.is_open(); + if (!file1.is_open()) { + return; + } + + char buf[2048]{}; + while (!file1.eof()) { + auto [read_ec, read_size] = + async_simple::coro::syncAwait(file1.async_read(buf, 2048)); + if (read_ec) { + std::cout << read_ec.message() << "\n"; + return; + } + + std::cout << read_size << "\n"; + std::cout << std::string_view(buf, read_size) << "\n"; + } + + work.reset(); + thd.join(); +} + +void test_read_with_pool() { + std::string filename = "test1.txt"; + create_temp_file("test1.txt", 1024); + + coro_io::io_context_pool pool(std::thread::hardware_concurrency()); + std::thread thd([&pool] { + pool.run(); + }); + ylt::coro_file file(*pool.get_executor(), filename); + bool r = file.is_open(); + if (!file.is_open()) { + return; + } + + char buf[1024]{}; + + while (!file.eof()) { + auto [ec, read_size] = + async_simple::coro::syncAwait(file.async_read(buf, 1024)); + if (ec) { + std::cout << ec.message() << "\n"; + break; + } + + std::cout << read_size << "\n"; + std::cout << std::string_view(buf, read_size) << "\n"; + } + + std::string str = "test async write"; + ylt::coro_file file1(*pool.get_executor(), filename); + r = file1.is_open(); + if (!file1.is_open()) { + return; + } + auto ec = + async_simple::coro::syncAwait(file1.async_write(str.data(), str.size())); + if (ec) { + std::cout << ec.message() << "\n"; + } + + pool.stop(); + thd.join(); +} + +void test_write_with_pool() { + std::string filename = "test1.txt"; + create_temp_file("test1.txt", 10); + + coro_io::io_context_pool pool(std::thread::hardware_concurrency()); + std::thread thd([&pool] { + pool.run(); + }); + ylt::coro_file file(*pool.get_executor(), filename); + bool r = file.is_open(); + if (!file.is_open()) { + return; + } + + std::string str = "test async write"; + + auto ec = + async_simple::coro::syncAwait(file.async_write(str.data(), str.size())); + if (ec) { + std::cout << ec.message() << "\n"; + } + + std::cout << std::filesystem::file_size(filename) << "\n"; + assert(std::filesystem::file_size(filename) == 78); + + pool.stop(); + thd.join(); +} + +int main() { + test_write_with_pool(); + test_read_with_pool(); + + test_read_file(); + test_write_and_read_file(); +} \ No newline at end of file diff --git a/src/coro_file/tests/CMakeLists.txt b/src/coro_file/tests/CMakeLists.txt new file mode 100644 index 000000000..0c86b6d25 --- /dev/null +++ b/src/coro_file/tests/CMakeLists.txt @@ -0,0 +1,36 @@ +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests) +option(ENABLE_FILE_IO_URING "enable io_uring" OFF) +if(ENABLE_FILE_IO_URING) + message(STATUS "enable io_uring") + add_definitions(-DENABLE_FILE_IO_URING) + add_definitions(-DASIO_HAS_FILE) + add_definitions(-DASIO_HAS_IO_URING) +endif() + +if (UNIX) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") +endif() + +## manual import +include_directories(${yaLanTingLibs_SOURCE_DIR}/thirdparty/asio) +include_directories(${yaLanTingLibs_SOURCE_DIR}/thirdparty/async_simple) + + +add_executable(test_corofile + test_corofile.cpp + main.cpp + ) + +if(ENABLE_FILE_IO_URING) +if (UNIX) + target_link_libraries(test_corofile PRIVATE yalantinglibs::easylog doctest uring) +endif() +else() + target_link_libraries(test_corofile PRIVATE yalantinglibs::easylog doctest) +endif() + + +add_test(NAME test_corofile COMMAND test_corofile) + + + diff --git a/src/coro_file/tests/main.cpp b/src/coro_file/tests/main.cpp new file mode 100644 index 000000000..b1a9ae981 --- /dev/null +++ b/src/coro_file/tests/main.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2022, Alibaba Group Holding Limited; + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#define DOCTEST_CONFIG_IMPLEMENT + +#include "doctest.h" + +// doctest comments +// 'function' : must be 'attribute' - see issue #182 +DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4007) +int main(int argc, char** argv) { return doctest::Context(argc, argv).run(); } +DOCTEST_MSVC_SUPPRESS_WARNING_POP \ No newline at end of file diff --git a/src/coro_file/tests/test_corofile.cpp b/src/coro_file/tests/test_corofile.cpp new file mode 100644 index 000000000..be3816466 --- /dev/null +++ b/src/coro_file/tests/test_corofile.cpp @@ -0,0 +1,496 @@ +#include +#include +#include +#include +#include +#include + +#include "asio/io_context.hpp" +#include "async_simple/coro/SyncAwait.h" +#include "coro_io/coro_file.hpp" +#include "coro_io/coro_io.hpp" +#include "coro_io/io_context_pool.hpp" +#include "doctest.h" + +namespace fs = std::filesystem; + +constexpr uint64_t KB = 1024; +constexpr uint64_t MB = 1024 * KB; +constexpr uint64_t block_size = 4 * KB; + +std::vector create_filled_vec(std::string fill_with, + size_t size = block_size) { + if (fill_with.empty() || size == 0) + return std::vector{}; + std::vector ret(size); + size_t fill_with_size = fill_with.size(); + int cnt = size / fill_with_size; + int remain = size % fill_with_size; + for (int i = 0; i < cnt; i++) { + memcpy(ret.data() + i * fill_with_size, fill_with.data(), fill_with_size); + } + if (remain > 0) { + memcpy(ret.data() + size - remain, fill_with.data(), remain); + } + return ret; +} +void create_file(std::string filename, size_t file_size, + const std::vector& fill_with_vec) { + std::ofstream file(filename, std::ios::binary); + file.exceptions(std::ios_base::failbit | std::ios_base::badbit); + + if (!file) { + std::cout << "create file failed\n"; + return; + } + size_t fill_with_size = fill_with_vec.size(); + if (file_size == 0 || fill_with_size == 0) { + return; + } + int cnt = file_size / block_size; + int remain = file_size - block_size * cnt; + for (size_t i = 0; i < cnt; i++) { + file.write(fill_with_vec.data(), block_size); + } + if (remain > 0) { + file.write(fill_with_vec.data(), remain); + } + file.flush(); // can throw + return; +} + +TEST_CASE("small_file_read_test") { + std::string filename = "small_file_read_test.txt"; + std::string fill_with = "small_file_read_test"; + auto block_vec = create_filled_vec(fill_with); + create_file(filename, 1 * KB, block_vec); + asio::io_context ioc; + auto work = std::make_unique(ioc); + std::thread thd([&ioc] { + ioc.run(); + }); + + ylt::coro_file file(ioc.get_executor(), filename); + CHECK(file.is_open()); + + char buf[block_size]{}; + std::error_code ec; + size_t read_size; + while (!file.eof()) { + std::tie(ec, read_size) = + async_simple::coro::syncAwait(file.async_read(buf, block_size)); + if (ec) { + std::cout << ec.message() << "\n"; + break; + } + std::cout << read_size << std::endl; + CHECK(std::string_view(block_vec.data(), read_size) == + std::string_view(buf, read_size)); + } + work.reset(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} +TEST_CASE("large_file_read_test") { + std::string filename = "large_file_read_test.txt"; + std::string fill_with = "large_file_read_test"; + size_t file_size = 100 * MB; + auto block_vec = create_filled_vec(fill_with); + create_file(filename, file_size, block_vec); + CHECK(fs::file_size(filename) == file_size); + asio::io_context ioc; + auto work = std::make_unique(ioc); + std::thread thd([&ioc] { + ioc.run(); + }); + + ylt::coro_file file(ioc.get_executor(), filename); + CHECK(file.is_open()); + + char buf[block_size]{}; + size_t total_size = 0; + std::error_code ec; + size_t read_size; + while (!file.eof()) { + std::tie(ec, read_size) = + async_simple::coro::syncAwait(file.async_read(buf, block_size)); + if (ec) { + std::cout << ec.message() << "\n"; + break; + } + total_size += read_size; + CHECK(std::string_view(block_vec.data(), read_size) == + std::string_view(buf, read_size)); + } + CHECK(total_size == file_size); + work.reset(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} +TEST_CASE("empty_file_read_test") { + std::string filename = "empty_file_read_test.txt"; + std::string fill_with = ""; + auto block_vec = create_filled_vec(fill_with); + create_file(filename, 0, block_vec); + asio::io_context ioc; + auto work = std::make_unique(ioc); + std::thread thd([&ioc] { + ioc.run(); + }); + + ylt::coro_file file(ioc.get_executor(), filename); + CHECK(file.is_open()); + + char buf[block_size]{}; + std::error_code ec; + size_t read_size; + std::tie(ec, read_size) = + async_simple::coro::syncAwait(file.async_read(buf, block_size)); + if (ec) { + std::cout << ec.message() << "\n"; + } + auto read_content = std::string_view(buf, read_size); + CHECK(read_size == 0); + CHECK(read_content.empty()); + work.reset(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} +TEST_CASE("small_file_read_with_pool_test") { + std::string filename = "small_file_read_with_pool_test.txt"; + std::string fill_with = "small_file_read_with_pool_test"; + size_t file_size = 1 * KB; + auto block_vec = create_filled_vec(fill_with); + create_file(filename, file_size, block_vec); + CHECK(fs::file_size(filename) == file_size); + coro_io::io_context_pool pool(std::thread::hardware_concurrency()); + std::thread thd([&pool] { + pool.run(); + }); + + ylt::coro_file file(*pool.get_executor(), filename); + CHECK(file.is_open()); + + char buf[block_size]{}; + std::error_code ec; + size_t read_size; + while (!file.eof()) { + std::tie(ec, read_size) = + async_simple::coro::syncAwait(file.async_read(buf, block_size)); + if (ec) { + std::cout << ec.message() << "\n"; + break; + } + std::cout << read_size << std::endl; + CHECK(std::string_view(block_vec.data(), read_size) == + std::string_view(buf, read_size)); + } + pool.stop(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} +TEST_CASE("large_file_read_with_pool_test") { + std::string filename = "large_file_read_with_pool_test.txt"; + std::string fill_with = "large_file_read_with_pool_test"; + size_t file_size = 100 * MB; + auto block_vec = create_filled_vec(fill_with); + create_file(filename, file_size, block_vec); + CHECK(fs::file_size(filename) == file_size); + coro_io::io_context_pool pool(std::thread::hardware_concurrency()); + std::thread thd([&pool] { + pool.run(); + }); + + ylt::coro_file file(*pool.get_executor(), filename); + CHECK(file.is_open()); + + char buf[block_size]{}; + size_t total_size = 0; + std::error_code ec; + size_t read_size; + while (!file.eof()) { + std::tie(ec, read_size) = + async_simple::coro::syncAwait(file.async_read(buf, block_size)); + if (ec) { + std::cout << ec.message() << "\n"; + break; + } + total_size += read_size; + CHECK(std::string_view(block_vec.data(), read_size) == + std::string_view(buf, read_size)); + } + CHECK(total_size == file_size); + pool.stop(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} +TEST_CASE("small_file_write_test") { + std::string filename = "small_file_write_test.txt"; + asio::io_context ioc; + auto work = std::make_unique(ioc); + std::thread thd([&ioc] { + ioc.run(); + }); + + ylt::coro_file file(ioc.get_executor(), filename, ylt::open_mode::write); + CHECK(file.is_open()); + + char buf[512]{}; + + std::string file_content_0 = "small_file_write_test_0"; + + auto ec = async_simple::coro::syncAwait( + file.async_write(file_content_0.data(), file_content_0.size())); + if (ec) { + std::cout << ec.message() << "\n"; + } + + std::ifstream is(filename, std::ios::binary); + if (!is.is_open()) { + std::cout << "Failed to open file: " << filename << "\n"; + return; + } + is.seekg(0, std::ios::end); + auto size = is.tellg(); + is.seekg(0, std::ios::beg); + is.read(buf, size); + CHECK(size == file_content_0.size()); + is.close(); + auto read_content = std::string_view(buf, size); + std::cout << read_content << "\n"; + CHECK(read_content == file_content_0); + + std::string file_content_1 = "small_file_write_test_1"; + + ec = async_simple::coro::syncAwait( + file.async_write(file_content_1.data(), file_content_1.size())); + if (ec) { + std::cout << ec.message() << "\n"; + } + is.open(filename, std::ios::binary); + if (!is.is_open()) { + std::cout << "Failed to open file: " << filename << "\n"; + return; + } + is.seekg(0, std::ios::end); + size = is.tellg(); + is.seekg(0, std::ios::beg); + CHECK(size == (file_content_0.size() + file_content_1.size())); + is.read(buf, size); + is.close(); + read_content = std::string_view(buf, size); + std::cout << read_content << "\n"; + CHECK(read_content == (file_content_0 + file_content_1)); + + work.reset(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} +TEST_CASE("large_file_write_test") { + std::string filename = "large_file_write_test.txt"; + size_t file_size = 100 * MB; + asio::io_context ioc; + auto work = std::make_unique(ioc); + std::thread thd([&ioc] { + ioc.run(); + }); + + ylt::coro_file file(ioc.get_executor(), filename, ylt::open_mode::write); + CHECK(file.is_open()); + + auto block_vec = create_filled_vec("large_file_write_test"); + int cnt = file_size / block_size; + int remain = file_size % block_size; + while (cnt--) { + auto ec = async_simple::coro::syncAwait( + file.async_write(block_vec.data(), block_size)); + if (ec) { + std::cout << ec.message() << "\n"; + break; + } + } + if (remain > 0) { + auto ec = async_simple::coro::syncAwait( + file.async_write(block_vec.data(), remain)); + if (ec) { + std::cout << ec.message() << "\n"; + } + } + CHECK(fs::file_size(filename) == file_size); + std::ifstream is(filename, std::ios::binary); + if (!is.is_open()) { + std::cout << "Failed to open file: " << filename << "\n"; + return; + } + is.seekg(0, std::ios::end); + auto size = is.tellg(); + is.seekg(0, std::ios::beg); + CHECK(size == file_size); + + std::vector read_content(block_size); + while (!is.eof()) { + is.read(read_content.data(), block_size); + CHECK(std::string_view(read_content.data(), is.gcount()) == + std::string_view(block_vec.data(), is.gcount())); + } + is.close(); + work.reset(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} +TEST_CASE("empty_file_write_test") { + std::string filename = "empty_file_write_test.txt"; + asio::io_context ioc; + auto work = std::make_unique(ioc); + std::thread thd([&ioc] { + ioc.run(); + }); + + ylt::coro_file file(ioc.get_executor(), filename, ylt::open_mode::write); + CHECK(file.is_open()); + + char buf[512]{}; + + std::string file_content_0 = "small_file_write_test_0"; + + auto ec = + async_simple::coro::syncAwait(file.async_write(file_content_0.data(), 0)); + if (ec) { + std::cout << ec.message() << "\n"; + } + + std::ifstream is(filename, std::ios::binary); + if (!is.is_open()) { + std::cout << "Failed to open file: " << filename << "\n"; + return; + } + is.seekg(0, std::ios::end); + auto size = is.tellg(); + CHECK(size == 0); + is.close(); + work.reset(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} +TEST_CASE("small_file_write_with_pool_test") { + std::string filename = "small_file_write_with_pool_test.txt"; + coro_io::io_context_pool pool(std::thread::hardware_concurrency()); + std::thread thd([&pool] { + pool.run(); + }); + + ylt::coro_file file(*pool.get_executor(), filename, ylt::open_mode::write); + CHECK(file.is_open()); + + char buf[512]{}; + + std::string file_content_0 = "small_file_write_with_pool_test_0"; + + auto ec = async_simple::coro::syncAwait( + file.async_write(file_content_0.data(), file_content_0.size())); + if (ec) { + std::cout << ec.message() << "\n"; + } + + std::ifstream is(filename, std::ios::binary); + if (!is.is_open()) { + std::cout << "Failed to open file: " << filename << "\n"; + return; + } + is.seekg(0, std::ios::end); + auto size = is.tellg(); + is.seekg(0, std::ios::beg); + is.read(buf, size); + CHECK(size == file_content_0.size()); + is.close(); + auto read_content = std::string_view(buf, size); + std::cout << read_content << "\n"; + CHECK(read_content == file_content_0); + + std::string file_content_1 = "small_file_write_with_pool_test_1"; + + ec = async_simple::coro::syncAwait( + file.async_write(file_content_1.data(), file_content_1.size())); + if (ec) { + std::cout << ec.message() << "\n"; + } + is.open(filename, std::ios::binary); + if (!is.is_open()) { + std::cout << "Failed to open file: " << filename << "\n"; + return; + } + is.seekg(0, std::ios::end); + size = is.tellg(); + is.seekg(0, std::ios::beg); + CHECK(size == (file_content_0.size() + file_content_1.size())); + is.read(buf, size); + is.close(); + read_content = std::string_view(buf, size); + std::cout << read_content << "\n"; + CHECK(read_content == (file_content_0 + file_content_1)); + + pool.stop(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} +TEST_CASE("large_file_write_with_pool_test") { + std::string filename = "large_file_write_with_pool_test.txt"; + size_t file_size = 100 * MB; + coro_io::io_context_pool pool(std::thread::hardware_concurrency()); + std::thread thd([&pool] { + pool.run(); + }); + + ylt::coro_file file(*pool.get_executor(), filename, ylt::open_mode::write); + CHECK(file.is_open()); + + auto block_vec = create_filled_vec("large_file_write_with_pool_test"); + int cnt = file_size / block_size; + int remain = file_size % block_size; + while (cnt--) { + auto ec = async_simple::coro::syncAwait( + file.async_write(block_vec.data(), block_size)); + if (ec) { + std::cout << ec.message() << "\n"; + break; + } + } + if (remain > 0) { + auto ec = async_simple::coro::syncAwait( + file.async_write(block_vec.data(), remain)); + if (ec) { + std::cout << ec.message() << "\n"; + } + } + CHECK(fs::file_size(filename) == file_size); + std::ifstream is(filename, std::ios::binary); + if (!is.is_open()) { + std::cout << "Failed to open file: " << filename << "\n"; + return; + } + is.seekg(0, std::ios::end); + auto size = is.tellg(); + is.seekg(0, std::ios::beg); + CHECK(size == file_size); + + std::vector read_content(block_size); + while (!is.eof()) { + is.read(read_content.data(), block_size); + CHECK(std::string_view(read_content.data(), is.gcount()) == + std::string_view(block_vec.data(), is.gcount())); + } + is.close(); + pool.stop(); + thd.join(); + file.close(); + fs::remove(fs::path(filename)); +} diff --git a/thirdparty/asio/asio.hpp b/thirdparty/asio/asio.hpp index 855f98e58..8c78e5723 100644 --- a/thirdparty/asio/asio.hpp +++ b/thirdparty/asio/asio.hpp @@ -12,14 +12,14 @@ #define ASIO_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) -#pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/append.hpp" #include "asio/as_tuple.hpp" #include "asio/associated_allocator.hpp" -#include "asio/associated_cancellation_slot.hpp" #include "asio/associated_executor.hpp" +#include "asio/associated_cancellation_slot.hpp" #include "asio/associator.hpp" #include "asio/async_result.hpp" #include "asio/awaitable.hpp" @@ -47,12 +47,12 @@ #include "asio/bind_executor.hpp" #include "asio/buffer.hpp" #include "asio/buffer_registration.hpp" -#include "asio/buffered_read_stream.hpp" #include "asio/buffered_read_stream_fwd.hpp" -#include "asio/buffered_stream.hpp" +#include "asio/buffered_read_stream.hpp" #include "asio/buffered_stream_fwd.hpp" -#include "asio/buffered_write_stream.hpp" +#include "asio/buffered_stream.hpp" #include "asio/buffered_write_stream_fwd.hpp" +#include "asio/buffered_write_stream.hpp" #include "asio/buffers_iterator.hpp" #include "asio/cancellation_signal.hpp" #include "asio/cancellation_state.hpp" @@ -122,6 +122,8 @@ #include "asio/ip/address_v6.hpp" #include "asio/ip/address_v6_iterator.hpp" #include "asio/ip/address_v6_range.hpp" +#include "asio/ip/network_v4.hpp" +#include "asio/ip/network_v6.hpp" #include "asio/ip/bad_address_cast.hpp" #include "asio/ip/basic_endpoint.hpp" #include "asio/ip/basic_resolver.hpp" @@ -131,8 +133,6 @@ #include "asio/ip/host_name.hpp" #include "asio/ip/icmp.hpp" #include "asio/ip/multicast.hpp" -#include "asio/ip/network_v4.hpp" -#include "asio/ip/network_v6.hpp" #include "asio/ip/resolver_base.hpp" #include "asio/ip/resolver_query_base.hpp" #include "asio/ip/tcp.hpp" @@ -205,4 +205,4 @@ #include "asio/write.hpp" #include "asio/write_at.hpp" -#endif // ASIO_HPP +#endif // ASIO_HPP diff --git a/thirdparty/asio/asio/any_completion_executor.hpp b/thirdparty/asio/asio/any_completion_executor.hpp deleted file mode 100644 index 420927cc1..000000000 --- a/thirdparty/asio/asio/any_completion_executor.hpp +++ /dev/null @@ -1,342 +0,0 @@ -// -// any_completion_executor.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2023 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) -// - -#ifndef ASIO_ANY_COMPLETION_EXECUTOR_HPP -#define ASIO_ANY_COMPLETION_EXECUTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" -#if defined(ASIO_USE_TS_EXECUTOR_AS_DEFAULT) -# include "asio/executor.hpp" -#else // defined(ASIO_USE_TS_EXECUTOR_AS_DEFAULT) -# include "asio/execution.hpp" -#endif // defined(ASIO_USE_TS_EXECUTOR_AS_DEFAULT) - -#include "asio/detail/push_options.hpp" - -namespace asio { - -#if defined(ASIO_USE_TS_EXECUTOR_AS_DEFAULT) - -typedef executor any_completion_executor; - -#else // defined(ASIO_USE_TS_EXECUTOR_AS_DEFAULT) - -/// Polymorphic executor type for use with I/O objects. -/** - * The @c any_completion_executor type is a polymorphic executor that supports - * the set of properties required for the execution of completion handlers. It - * is defined as the execution::any_executor class template parameterised as - * follows: - * @code execution::any_executor< - * execution::prefer_only, - * execution::prefer_only - * execution::prefer_only, - * execution::prefer_only - * > @endcode - */ -class any_completion_executor : -#if defined(GENERATING_DOCUMENTATION) - public execution::any_executor<...> -#else // defined(GENERATING_DOCUMENTATION) - public execution::any_executor< - execution::prefer_only, - execution::prefer_only, - execution::prefer_only, - execution::prefer_only - > -#endif // defined(GENERATING_DOCUMENTATION) -{ -public: -#if !defined(GENERATING_DOCUMENTATION) - typedef execution::any_executor< - execution::prefer_only, - execution::prefer_only, - execution::prefer_only, - execution::prefer_only - > base_type; - - typedef void supportable_properties_type( - execution::prefer_only, - execution::prefer_only, - execution::prefer_only, - execution::prefer_only - ); -#endif // !defined(GENERATING_DOCUMENTATION) - - /// Default constructor. - ASIO_DECL any_completion_executor() ASIO_NOEXCEPT; - - /// Construct in an empty state. Equivalent effects to default constructor. - ASIO_DECL any_completion_executor(nullptr_t) ASIO_NOEXCEPT; - - /// Copy constructor. - ASIO_DECL any_completion_executor( - const any_completion_executor& e) ASIO_NOEXCEPT; - -#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move constructor. - ASIO_DECL any_completion_executor( - any_completion_executor&& e) ASIO_NOEXCEPT; -#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Construct to point to the same target as another any_executor. -#if defined(GENERATING_DOCUMENTATION) - template - any_completion_executor( - execution::any_executor e); -#else // defined(GENERATING_DOCUMENTATION) - template - any_completion_executor(OtherAnyExecutor e, - typename constraint< - conditional< - !is_same::value - && is_base_of::value, - typename execution::detail::supportable_properties< - 0, supportable_properties_type>::template - is_valid_target, - false_type - >::type::value - >::type = 0) - : base_type(ASIO_MOVE_CAST(OtherAnyExecutor)(e)) - { - } -#endif // defined(GENERATING_DOCUMENTATION) - - /// Construct to point to the same target as another any_executor. -#if defined(GENERATING_DOCUMENTATION) - template - any_completion_executor(std::nothrow_t, - execution::any_executor e); -#else // defined(GENERATING_DOCUMENTATION) - template - any_completion_executor(std::nothrow_t, OtherAnyExecutor e, - typename constraint< - conditional< - !is_same::value - && is_base_of::value, - typename execution::detail::supportable_properties< - 0, supportable_properties_type>::template - is_valid_target, - false_type - >::type::value - >::type = 0) ASIO_NOEXCEPT - : base_type(std::nothrow, ASIO_MOVE_CAST(OtherAnyExecutor)(e)) - { - } -#endif // defined(GENERATING_DOCUMENTATION) - - /// Construct to point to the same target as another any_executor. - ASIO_DECL any_completion_executor(std::nothrow_t, - const any_completion_executor& e) ASIO_NOEXCEPT; - -#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Construct to point to the same target as another any_executor. - ASIO_DECL any_completion_executor(std::nothrow_t, - any_completion_executor&& e) ASIO_NOEXCEPT; -#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Construct a polymorphic wrapper for the specified executor. -#if defined(GENERATING_DOCUMENTATION) - template - any_completion_executor(Executor e); -#else // defined(GENERATING_DOCUMENTATION) - template - any_completion_executor(Executor e, - typename constraint< - conditional< - !is_same::value - && !is_base_of::value, - execution::detail::is_valid_target_executor< - Executor, supportable_properties_type>, - false_type - >::type::value - >::type = 0) - : base_type(ASIO_MOVE_CAST(Executor)(e)) - { - } -#endif // defined(GENERATING_DOCUMENTATION) - - /// Construct a polymorphic wrapper for the specified executor. -#if defined(GENERATING_DOCUMENTATION) - template - any_completion_executor(std::nothrow_t, Executor e); -#else // defined(GENERATING_DOCUMENTATION) - template - any_completion_executor(std::nothrow_t, Executor e, - typename constraint< - conditional< - !is_same::value - && !is_base_of::value, - execution::detail::is_valid_target_executor< - Executor, supportable_properties_type>, - false_type - >::type::value - >::type = 0) ASIO_NOEXCEPT - : base_type(std::nothrow, ASIO_MOVE_CAST(Executor)(e)) - { - } -#endif // defined(GENERATING_DOCUMENTATION) - - /// Assignment operator. - ASIO_DECL any_completion_executor& operator=( - const any_completion_executor& e) ASIO_NOEXCEPT; - -#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move assignment operator. - ASIO_DECL any_completion_executor& operator=( - any_completion_executor&& e) ASIO_NOEXCEPT; -#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - - /// Assignment operator that sets the polymorphic wrapper to the empty state. - ASIO_DECL any_completion_executor& operator=(nullptr_t); - - /// Destructor. - ASIO_DECL ~any_completion_executor(); - - /// Swap targets with another polymorphic wrapper. - ASIO_DECL void swap(any_completion_executor& other) ASIO_NOEXCEPT; - - /// Obtain a polymorphic wrapper with the specified property. - /** - * Do not call this function directly. It is intended for use with the - * asio::require and asio::prefer customisation points. - * - * For example: - * @code any_completion_executor ex = ...; - * auto ex2 = asio::require(ex, execution::relationship.fork); @endcode - */ - template - any_completion_executor require(const Property& p, - typename constraint< - traits::require_member::is_valid - >::type = 0) const - { - return static_cast(*this).require(p); - } - - /// Obtain a polymorphic wrapper with the specified property. - /** - * Do not call this function directly. It is intended for use with the - * asio::prefer customisation point. - * - * For example: - * @code any_completion_executor ex = ...; - * auto ex2 = asio::prefer(ex, execution::relationship.fork); @endcode - */ - template - any_completion_executor prefer(const Property& p, - typename constraint< - traits::prefer_member::is_valid - >::type = 0) const - { - return static_cast(*this).prefer(p); - } -}; - -#if !defined(GENERATING_DOCUMENTATION) - -template <> -ASIO_DECL any_completion_executor any_completion_executor::prefer( - const execution::outstanding_work_t::tracked_t&, int) const; - -template <> -ASIO_DECL any_completion_executor any_completion_executor::prefer( - const execution::outstanding_work_t::untracked_t&, int) const; - -template <> -ASIO_DECL any_completion_executor any_completion_executor::prefer( - const execution::relationship_t::fork_t&, int) const; - -template <> -ASIO_DECL any_completion_executor any_completion_executor::prefer( - const execution::relationship_t::continuation_t&, int) const; - -namespace traits { - -#if !defined(ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) - -template <> -struct equality_comparable -{ - static const bool is_valid = true; - static const bool is_noexcept = true; -}; - -#endif // !defined(ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) - -#if !defined(ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) - -template -struct execute_member -{ - static const bool is_valid = true; - static const bool is_noexcept = false; - typedef void result_type; -}; - -#endif // !defined(ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) - -#if !defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) - -template -struct query_member : - query_member -{ -}; - -#endif // !defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) - -#if !defined(ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) - -template -struct require_member : - require_member -{ - typedef any_completion_executor result_type; -}; - -#endif // !defined(ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) - -#if !defined(ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT) - -template -struct prefer_member : - prefer_member -{ - typedef any_completion_executor result_type; -}; - -#endif // !defined(ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT) - -} // namespace traits - -#endif // !defined(GENERATING_DOCUMENTATION) - -#endif // defined(ASIO_USE_TS_EXECUTOR_AS_DEFAULT) - -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#if defined(ASIO_HEADER_ONLY) \ - && !defined(ASIO_USE_TS_EXECUTOR_AS_DEFAULT) -# include "asio/impl/any_completion_executor.ipp" -#endif // defined(ASIO_HEADER_ONLY) - // && !defined(ASIO_USE_TS_EXECUTOR_AS_DEFAULT) - -#endif // ASIO_ANY_COMPLETION_EXECUTOR_HPP diff --git a/thirdparty/asio/asio/any_completion_handler.hpp b/thirdparty/asio/asio/any_completion_handler.hpp deleted file mode 100644 index 68ec796c6..000000000 --- a/thirdparty/asio/asio/any_completion_handler.hpp +++ /dev/null @@ -1,684 +0,0 @@ -// -// any_completion_handler.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2023 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) -// - -#ifndef ASIO_ANY_COMPLETION_HANDLER_HPP -#define ASIO_ANY_COMPLETION_HANDLER_HPP - -#include "asio/detail/config.hpp" - -#if (defined(ASIO_HAS_STD_TUPLE) \ - && defined(ASIO_HAS_MOVE) \ - && defined(ASIO_HAS_VARIADIC_TEMPLATES)) \ - || defined(GENERATING_DOCUMENTATION) - -#include -#include -#include -#include -#include "asio/any_completion_executor.hpp" -#include "asio/associated_allocator.hpp" -#include "asio/associated_cancellation_slot.hpp" -#include "asio/associated_executor.hpp" -#include "asio/cancellation_state.hpp" -#include "asio/recycling_allocator.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { -namespace detail { - -class any_completion_handler_impl_base -{ -public: - template - explicit any_completion_handler_impl_base(S&& slot) - : cancel_state_(ASIO_MOVE_CAST(S)(slot), enable_total_cancellation()) - { - } - - cancellation_slot get_cancellation_slot() const ASIO_NOEXCEPT - { - return cancel_state_.slot(); - } - -private: - cancellation_state cancel_state_; -}; - -template -class any_completion_handler_impl : - public any_completion_handler_impl_base -{ -public: - template - any_completion_handler_impl(S&& slot, H&& h) - : any_completion_handler_impl_base(ASIO_MOVE_CAST(S)(slot)), - handler_(ASIO_MOVE_CAST(H)(h)) - { - } - - struct uninit_deleter - { - typename std::allocator_traits< - associated_allocator_t>>::template - rebind_alloc alloc; - - void operator()(any_completion_handler_impl* ptr) - { - std::allocator_traits::deallocate(alloc, ptr, 1); - } - }; - - struct deleter - { - typename std::allocator_traits< - associated_allocator_t>>::template - rebind_alloc alloc; - - void operator()(any_completion_handler_impl* ptr) - { - std::allocator_traits::destroy(alloc, ptr); - std::allocator_traits::deallocate(alloc, ptr, 1); - } - }; - - template - static any_completion_handler_impl* create(S&& slot, H&& h) - { - uninit_deleter d{ - (get_associated_allocator)(h, - asio::recycling_allocator())}; - - std::unique_ptr uninit_ptr( - std::allocator_traits::allocate(d.alloc, 1), d); - - any_completion_handler_impl* ptr = - new (uninit_ptr.get()) any_completion_handler_impl( - ASIO_MOVE_CAST(S)(slot), ASIO_MOVE_CAST(H)(h)); - - uninit_ptr.release(); - return ptr; - } - - void destroy() - { - deleter d{ - (get_associated_allocator)(handler_, - asio::recycling_allocator())}; - - d(this); - } - - any_completion_executor executor( - const any_completion_executor& candidate) const ASIO_NOEXCEPT - { - return any_completion_executor(std::nothrow, - (get_associated_executor)(handler_, candidate)); - } - - void* allocate(std::size_t size, std::size_t align) const - { - typename std::allocator_traits< - associated_allocator_t>>::template - rebind_alloc alloc( - (get_associated_allocator)(handler_, - asio::recycling_allocator())); - - std::size_t space = size + align - 1; - unsigned char* base = - std::allocator_traits::allocate( - alloc, space + sizeof(std::ptrdiff_t)); - - void* p = base; - if (detail::align(align, size, p, space)) - { - std::ptrdiff_t off = static_cast(p) - base; - std::memcpy(static_cast(p) + size, &off, sizeof(off)); - return p; - } - - std::bad_alloc ex; - asio::detail::throw_exception(ex); - return nullptr; - } - - void deallocate(void* p, std::size_t size, std::size_t align) const - { - if (p) - { - typename std::allocator_traits< - associated_allocator_t>>::template - rebind_alloc alloc( - (get_associated_allocator)(handler_, - asio::recycling_allocator())); - - std::ptrdiff_t off; - std::memcpy(&off, static_cast(p) + size, sizeof(off)); - unsigned char* base = static_cast(p) - off; - - std::allocator_traits::deallocate( - alloc, base, size + align -1 + sizeof(std::ptrdiff_t)); - } - } - - template - void call(Args&&... args) - { - deleter d{ - (get_associated_allocator)(handler_, - asio::recycling_allocator())}; - - std::unique_ptr ptr(this, d); - Handler handler(ASIO_MOVE_CAST(Handler)(handler_)); - ptr.reset(); - - ASIO_MOVE_CAST(Handler)(handler)( - ASIO_MOVE_CAST(Args)(args)...); - } - -private: - Handler handler_; -}; - -template -class any_completion_handler_call_fn; - -template -class any_completion_handler_call_fn -{ -public: - using type = void(*)(any_completion_handler_impl_base*, Args...); - - constexpr any_completion_handler_call_fn(type fn) - : call_fn_(fn) - { - } - - void call(any_completion_handler_impl_base* impl, Args... args) const - { - call_fn_(impl, ASIO_MOVE_CAST(Args)(args)...); - } - - template - static void impl(any_completion_handler_impl_base* impl, Args... args) - { - static_cast*>(impl)->call( - ASIO_MOVE_CAST(Args)(args)...); - } - -private: - type call_fn_; -}; - -template -class any_completion_handler_call_fns; - -template -class any_completion_handler_call_fns : - public any_completion_handler_call_fn -{ -public: - using any_completion_handler_call_fn< - Signature>::any_completion_handler_call_fn; - using any_completion_handler_call_fn::call; -}; - -template -class any_completion_handler_call_fns : - public any_completion_handler_call_fn, - public any_completion_handler_call_fns -{ -public: - template - constexpr any_completion_handler_call_fns(CallFn fn, CallFns... fns) - : any_completion_handler_call_fn(fn), - any_completion_handler_call_fns(fns...) - { - } - - using any_completion_handler_call_fn::call; - using any_completion_handler_call_fns::call; -}; - -class any_completion_handler_destroy_fn -{ -public: - using type = void(*)(any_completion_handler_impl_base*); - - constexpr any_completion_handler_destroy_fn(type fn) - : destroy_fn_(fn) - { - } - - void destroy(any_completion_handler_impl_base* impl) const - { - destroy_fn_(impl); - } - - template - static void impl(any_completion_handler_impl_base* impl) - { - static_cast*>(impl)->destroy(); - } - -private: - type destroy_fn_; -}; - -class any_completion_handler_executor_fn -{ -public: - using type = any_completion_executor(*)( - any_completion_handler_impl_base*, const any_completion_executor&); - - constexpr any_completion_handler_executor_fn(type fn) - : executor_fn_(fn) - { - } - - any_completion_executor executor(any_completion_handler_impl_base* impl, - const any_completion_executor& candidate) const - { - return executor_fn_(impl, candidate); - } - - template - static any_completion_executor impl(any_completion_handler_impl_base* impl, - const any_completion_executor& candidate) - { - return static_cast*>(impl)->executor( - candidate); - } - -private: - type executor_fn_; -}; - -class any_completion_handler_allocate_fn -{ -public: - using type = void*(*)(any_completion_handler_impl_base*, - std::size_t, std::size_t); - - constexpr any_completion_handler_allocate_fn(type fn) - : allocate_fn_(fn) - { - } - - void* allocate(any_completion_handler_impl_base* impl, - std::size_t size, std::size_t align) const - { - return allocate_fn_(impl, size, align); - } - - template - static void* impl(any_completion_handler_impl_base* impl, - std::size_t size, std::size_t align) - { - return static_cast*>(impl)->allocate( - size, align); - } - -private: - type allocate_fn_; -}; - -class any_completion_handler_deallocate_fn -{ -public: - using type = void(*)(any_completion_handler_impl_base*, - void*, std::size_t, std::size_t); - - constexpr any_completion_handler_deallocate_fn(type fn) - : deallocate_fn_(fn) - { - } - - void deallocate(any_completion_handler_impl_base* impl, - void* p, std::size_t size, std::size_t align) const - { - deallocate_fn_(impl, p, size, align); - } - - template - static void impl(any_completion_handler_impl_base* impl, - void* p, std::size_t size, std::size_t align) - { - static_cast*>(impl)->deallocate( - p, size, align); - } - -private: - type deallocate_fn_; -}; - -template -class any_completion_handler_fn_table - : private any_completion_handler_destroy_fn, - private any_completion_handler_executor_fn, - private any_completion_handler_allocate_fn, - private any_completion_handler_deallocate_fn, - private any_completion_handler_call_fns -{ -public: - template - constexpr any_completion_handler_fn_table( - any_completion_handler_destroy_fn::type destroy_fn, - any_completion_handler_executor_fn::type executor_fn, - any_completion_handler_allocate_fn::type allocate_fn, - any_completion_handler_deallocate_fn::type deallocate_fn, - CallFns... call_fns) - : any_completion_handler_destroy_fn(destroy_fn), - any_completion_handler_executor_fn(executor_fn), - any_completion_handler_allocate_fn(allocate_fn), - any_completion_handler_deallocate_fn(deallocate_fn), - any_completion_handler_call_fns(call_fns...) - { - } - - using any_completion_handler_destroy_fn::destroy; - using any_completion_handler_executor_fn::executor; - using any_completion_handler_allocate_fn::allocate; - using any_completion_handler_deallocate_fn::deallocate; - using any_completion_handler_call_fns::call; -}; - -template -struct any_completion_handler_fn_table_instance -{ - static constexpr any_completion_handler_fn_table - value = any_completion_handler_fn_table( - &any_completion_handler_destroy_fn::impl, - &any_completion_handler_executor_fn::impl, - &any_completion_handler_allocate_fn::impl, - &any_completion_handler_deallocate_fn::impl, - &any_completion_handler_call_fn::template impl...); -}; - -template -constexpr any_completion_handler_fn_table -any_completion_handler_fn_table_instance::value; - -} // namespace detail - -template -class any_completion_handler; - -template -class any_completion_handler_allocator -{ -private: - template - friend class any_completion_handler; - - template - friend class any_completion_handler_allocator; - - const detail::any_completion_handler_fn_table* fn_table_; - detail::any_completion_handler_impl_base* impl_; - - constexpr any_completion_handler_allocator(int, - const any_completion_handler& h) ASIO_NOEXCEPT - : fn_table_(h.fn_table_), - impl_(h.impl_) - { - } - -public: - typedef T value_type; - - template - struct rebind - { - typedef any_completion_handler_allocator other; - }; - - template - constexpr any_completion_handler_allocator( - const any_completion_handler_allocator& a) - ASIO_NOEXCEPT - : fn_table_(a.fn_table_), - impl_(a.impl_) - { - } - - constexpr bool operator==( - const any_completion_handler_allocator& other) const ASIO_NOEXCEPT - { - return fn_table_ == other.fn_table_ && impl_ == other.impl_; - } - - constexpr bool operator!=( - const any_completion_handler_allocator& other) const ASIO_NOEXCEPT - { - return fn_table_ != other.fn_table_ || impl_ != other.impl_; - } - - T* allocate(std::size_t n) const - { - return static_cast( - fn_table_->allocate( - impl_, sizeof(T) * n, alignof(T))); - } - - void deallocate(T* p, std::size_t n) const - { - fn_table_->deallocate(impl_, p, sizeof(T) * n, alignof(T)); - } -}; - -template -class any_completion_handler_allocator -{ -private: - template - friend class any_completion_handler; - - template - friend class any_completion_handler_allocator; - - const detail::any_completion_handler_fn_table* fn_table_; - detail::any_completion_handler_impl_base* impl_; - - constexpr any_completion_handler_allocator(int, - const any_completion_handler& h) ASIO_NOEXCEPT - : fn_table_(h.fn_table_), - impl_(h.impl_) - { - } - -public: - typedef void value_type; - - template - struct rebind - { - typedef any_completion_handler_allocator other; - }; - - template - constexpr any_completion_handler_allocator( - const any_completion_handler_allocator& a) - ASIO_NOEXCEPT - : fn_table_(a.fn_table_), - impl_(a.impl_) - { - } - - constexpr bool operator==( - const any_completion_handler_allocator& other) const ASIO_NOEXCEPT - { - return fn_table_ == other.fn_table_ && impl_ == other.impl_; - } - - constexpr bool operator!=( - const any_completion_handler_allocator& other) const ASIO_NOEXCEPT - { - return fn_table_ != other.fn_table_ || impl_ != other.impl_; - } -}; - -template -class any_completion_handler -{ -private: - template - friend class any_completion_handler_allocator; - - template - friend struct associated_executor; - - const detail::any_completion_handler_fn_table* fn_table_; - detail::any_completion_handler_impl_base* impl_; - -public: - using allocator_type = any_completion_handler_allocator; - using cancellation_slot_type = cancellation_slot; - - constexpr any_completion_handler() - : fn_table_(nullptr), - impl_(nullptr) - { - } - - constexpr any_completion_handler(nullptr_t) - : fn_table_(nullptr), - impl_(nullptr) - { - } - - template ::type> - any_completion_handler(H&& h) - : fn_table_( - &detail::any_completion_handler_fn_table_instance< - Handler, Signatures...>::value), - impl_(detail::any_completion_handler_impl::create( - (get_associated_cancellation_slot)(h), ASIO_MOVE_CAST(H)(h))) - { - } - - any_completion_handler(any_completion_handler&& other) ASIO_NOEXCEPT - : fn_table_(other.fn_table_), - impl_(other.impl_) - { - other.fn_table_ = nullptr; - other.impl_ = nullptr; - } - - any_completion_handler& operator=( - any_completion_handler&& other) ASIO_NOEXCEPT - { - any_completion_handler(other).swap(*this); - return *this; - } - - any_completion_handler& operator=(nullptr_t) ASIO_NOEXCEPT - { - any_completion_handler().swap(*this); - return *this; - } - - ~any_completion_handler() - { - if (impl_) - fn_table_->destroy(impl_); - } - - constexpr explicit operator bool() const ASIO_NOEXCEPT - { - return impl_ != nullptr; - } - - constexpr bool operator!() const ASIO_NOEXCEPT - { - return impl_ == nullptr; - } - - void swap(any_completion_handler& other) ASIO_NOEXCEPT - { - std::swap(fn_table_, other.fn_table_); - std::swap(impl_, other.impl_); - } - - allocator_type get_allocator() const ASIO_NOEXCEPT - { - return allocator_type(0, *this); - } - - cancellation_slot_type get_cancellation_slot() const ASIO_NOEXCEPT - { - return impl_->get_cancellation_slot(); - } - - template - auto operator()(Args&&... args) - -> decltype(fn_table_->call(impl_, ASIO_MOVE_CAST(Args)(args)...)) - { - if (detail::any_completion_handler_impl_base* impl = impl_) - { - impl_ = nullptr; - return fn_table_->call(impl, ASIO_MOVE_CAST(Args)(args)...); - } - std::bad_function_call ex; - asio::detail::throw_exception(ex); - } - - friend constexpr bool operator==( - const any_completion_handler& a, nullptr_t) ASIO_NOEXCEPT - { - return a.impl_ == nullptr; - } - - friend constexpr bool operator==( - nullptr_t, const any_completion_handler& b) ASIO_NOEXCEPT - { - return nullptr == b.impl_; - } - - friend constexpr bool operator!=( - const any_completion_handler& a, nullptr_t) ASIO_NOEXCEPT - { - return a.impl_ != nullptr; - } - - friend constexpr bool operator!=( - nullptr_t, const any_completion_handler& b) ASIO_NOEXCEPT - { - return nullptr != b.impl_; - } -}; - -template -struct associated_executor, Candidate> -{ - using type = any_completion_executor; - - static type get(const any_completion_handler& handler, - const Candidate& candidate = Candidate()) ASIO_NOEXCEPT - { - return handler.fn_table_->executor(handler.impl_, - any_completion_executor(std::nothrow, candidate)); - } -}; - -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // (defined(ASIO_HAS_STD_TUPLE) - // && defined(ASIO_HAS_MOVE) - // && defined(ASIO_HAS_VARIADIC_TEMPLATES)) - // || defined(GENERATING_DOCUMENTATION) - -#endif // ASIO_ANY_COMPLETION_HANDLER_HPP diff --git a/thirdparty/asio/asio/any_io_executor.hpp b/thirdparty/asio/asio/any_io_executor.hpp index 7a77c90d1..36c54277b 100644 --- a/thirdparty/asio/asio/any_io_executor.hpp +++ b/thirdparty/asio/asio/any_io_executor.hpp @@ -2,7 +2,7 @@ // any_io_executor.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -123,40 +123,6 @@ class any_io_executor : } #endif // defined(GENERATING_DOCUMENTATION) - /// Construct to point to the same target as another any_executor. -#if defined(GENERATING_DOCUMENTATION) - template - any_io_executor(std::nothrow_t, - execution::any_executor e); -#else // defined(GENERATING_DOCUMENTATION) - template - any_io_executor(std::nothrow_t, OtherAnyExecutor e, - typename constraint< - conditional< - !is_same::value - && is_base_of::value, - typename execution::detail::supportable_properties< - 0, supportable_properties_type>::template - is_valid_target, - false_type - >::type::value - >::type = 0) ASIO_NOEXCEPT - : base_type(std::nothrow, ASIO_MOVE_CAST(OtherAnyExecutor)(e)) - { - } -#endif // defined(GENERATING_DOCUMENTATION) - - /// Construct to point to the same target as another any_executor. - ASIO_DECL any_io_executor(std::nothrow_t, - const any_io_executor& e) ASIO_NOEXCEPT; - -#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Construct to point to the same target as another any_executor. - ASIO_DECL any_io_executor(std::nothrow_t, - any_io_executor&& e) ASIO_NOEXCEPT; -#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Construct a polymorphic wrapper for the specified executor. #if defined(GENERATING_DOCUMENTATION) template @@ -179,28 +145,6 @@ class any_io_executor : } #endif // defined(GENERATING_DOCUMENTATION) - /// Construct a polymorphic wrapper for the specified executor. -#if defined(GENERATING_DOCUMENTATION) - template - any_io_executor(std::nothrow_t, Executor e); -#else // defined(GENERATING_DOCUMENTATION) - template - any_io_executor(std::nothrow_t, Executor e, - typename constraint< - conditional< - !is_same::value - && !is_base_of::value, - execution::detail::is_valid_target_executor< - Executor, supportable_properties_type>, - false_type - >::type::value - >::type = 0) ASIO_NOEXCEPT - : base_type(std::nothrow, ASIO_MOVE_CAST(Executor)(e)) - { - } -#endif // defined(GENERATING_DOCUMENTATION) - /// Assignment operator. ASIO_DECL any_io_executor& operator=( const any_io_executor& e) ASIO_NOEXCEPT; diff --git a/thirdparty/asio/asio/append.hpp b/thirdparty/asio/asio/append.hpp index 9ac4a9504..227de90ff 100644 --- a/thirdparty/asio/asio/append.hpp +++ b/thirdparty/asio/asio/append.hpp @@ -2,7 +2,7 @@ // append.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/as_tuple.hpp b/thirdparty/asio/asio/as_tuple.hpp index 96ac47c82..0629033b8 100644 --- a/thirdparty/asio/asio/as_tuple.hpp +++ b/thirdparty/asio/asio/as_tuple.hpp @@ -2,7 +2,7 @@ // as_tuple.hpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/associated_allocator.hpp b/thirdparty/asio/asio/associated_allocator.hpp index 8e864673c..e391004b8 100644 --- a/thirdparty/asio/asio/associated_allocator.hpp +++ b/thirdparty/asio/asio/associated_allocator.hpp @@ -2,7 +2,7 @@ // associated_allocator.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -42,53 +42,37 @@ struct has_allocator_type +template struct associated_allocator_impl { - typedef void asio_associated_allocator_is_unspecialised; + typedef E type; - typedef A type; - - static type get(const T&) ASIO_NOEXCEPT - { - return type(); - } - - static const type& get(const T&, const A& a) ASIO_NOEXCEPT + static type get(const T&, const E& e) ASIO_NOEXCEPT { - return a; + return e; } }; -template -struct associated_allocator_impl +struct associated_allocator_impl::type> { typedef typename T::allocator_type type; - static ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( - const T& t) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_allocator())) - { - return t.get_allocator(); - } - - static ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( - const T& t, const A&) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_allocator())) + static type get(const T& t, const E&) ASIO_NOEXCEPT { return t.get_allocator(); } }; -template -struct associated_allocator_impl +struct associated_allocator_impl::value >::type, typename void_type< - typename associator::type - >::type> : associator + typename associator::type + >::type> : associator { }; @@ -108,32 +92,29 @@ struct associated_allocator_impl > struct associated_allocator -#if !defined(GENERATING_DOCUMENTATION) - : detail::associated_allocator_impl -#endif // !defined(GENERATING_DOCUMENTATION) { -#if defined(GENERATING_DOCUMENTATION) /// If @c T has a nested type @c allocator_type, T::allocator_type. /// Otherwise @c Allocator. +#if defined(GENERATING_DOCUMENTATION) typedef see_below type; - - /// If @c T has a nested type @c allocator_type, returns - /// t.get_allocator(). Otherwise returns @c type(). - static decltype(auto) get(const T& t) ASIO_NOEXCEPT; +#else // defined(GENERATING_DOCUMENTATION) + typedef typename detail::associated_allocator_impl::type type; +#endif // defined(GENERATING_DOCUMENTATION) /// If @c T has a nested type @c allocator_type, returns /// t.get_allocator(). Otherwise returns @c a. - static decltype(auto) get(const T& t, const Allocator& a) ASIO_NOEXCEPT; -#endif // defined(GENERATING_DOCUMENTATION) + static type get(const T& t, + const Allocator& a = Allocator()) ASIO_NOEXCEPT + { + return detail::associated_allocator_impl::get(t, a); + } }; /// Helper function to obtain an object's associated allocator. @@ -152,11 +133,8 @@ get_associated_allocator(const T& t) ASIO_NOEXCEPT * @returns associated_allocator::get(t, a) */ template -ASIO_NODISCARD inline ASIO_AUTO_RETURN_TYPE_PREFIX2( - typename associated_allocator::type) +ASIO_NODISCARD inline typename associated_allocator::type get_associated_allocator(const T& t, const Allocator& a) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_allocator::get(t, a))) { return associated_allocator::get(t, a); } @@ -169,37 +147,12 @@ using associated_allocator_t #endif // defined(ASIO_HAS_ALIAS_TEMPLATES) -namespace detail { - -template -struct associated_allocator_forwarding_base -{ -}; - -template -struct associated_allocator_forwarding_base::asio_associated_allocator_is_unspecialised, - void - >::value - >::type> -{ - typedef void asio_associated_allocator_is_unspecialised; -}; - -} // namespace detail - #if defined(ASIO_HAS_STD_REFERENCE_WRAPPER) \ || defined(GENERATING_DOCUMENTATION) /// Specialisation of associated_allocator for @c std::reference_wrapper. template struct associated_allocator, Allocator> -#if !defined(GENERATING_DOCUMENTATION) - : detail::associated_allocator_forwarding_base -#endif // !defined(GENERATING_DOCUMENTATION) { /// Forwards @c type to the associator specialisation for the unwrapped type /// @c T. @@ -207,17 +160,8 @@ struct associated_allocator, Allocator> /// Forwards the request to get the allocator to the associator specialisation /// for the unwrapped type @c T. - static type get(reference_wrapper t) ASIO_NOEXCEPT - { - return associated_allocator::get(t.get()); - } - - /// Forwards the request to get the allocator to the associator specialisation - /// for the unwrapped type @c T. - static ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( - reference_wrapper t, const Allocator& a) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_allocator::get(t.get(), a))) + static type get(reference_wrapper t, + const Allocator& a = Allocator()) ASIO_NOEXCEPT { return associated_allocator::get(t.get(), a); } diff --git a/thirdparty/asio/asio/associated_cancellation_slot.hpp b/thirdparty/asio/asio/associated_cancellation_slot.hpp index 65d82b646..8fb21b6b7 100644 --- a/thirdparty/asio/asio/associated_cancellation_slot.hpp +++ b/thirdparty/asio/asio/associated_cancellation_slot.hpp @@ -2,7 +2,7 @@ // associated_cancellation_slot.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -18,7 +18,6 @@ #include "asio/detail/config.hpp" #include "asio/associator.hpp" #include "asio/cancellation_signal.hpp" -#include "asio/detail/functional.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" @@ -49,12 +48,7 @@ struct associated_cancellation_slot_impl typedef S type; - static type get(const T&) ASIO_NOEXCEPT - { - return type(); - } - - static const type& get(const T&, const S& s) ASIO_NOEXCEPT + static type get(const T&, const S& s = S()) ASIO_NOEXCEPT { return s; } @@ -66,16 +60,7 @@ struct associated_cancellation_slot_impl struct associated_cancellation_slot @@ -127,14 +110,10 @@ struct associated_cancellation_slot /// @c CancellationSlot. typedef see_below type; - /// If @c T has a nested type @c cancellation_slot_type, returns - /// t.get_cancellation_slot(). Otherwise returns @c type(). - static decltype(auto) get(const T& t) ASIO_NOEXCEPT; - /// If @c T has a nested type @c cancellation_slot_type, returns /// t.get_cancellation_slot(). Otherwise returns @c s. - static decltype(auto) get(const T& t, - const CancellationSlot& s) ASIO_NOEXCEPT; + static type get(const T& t, + const CancellationSlot& s = CancellationSlot()) ASIO_NOEXCEPT; #endif // defined(GENERATING_DOCUMENTATION) }; @@ -155,12 +134,10 @@ get_associated_cancellation_slot(const T& t) ASIO_NOEXCEPT * CancellationSlot>::get(t, st) */ template -ASIO_NODISCARD inline ASIO_AUTO_RETURN_TYPE_PREFIX2( - typename associated_cancellation_slot::type) +ASIO_NODISCARD inline +typename associated_cancellation_slot::type get_associated_cancellation_slot(const T& t, const CancellationSlot& st) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_cancellation_slot::get(t, st))) { return associated_cancellation_slot::get(t, st); } @@ -194,43 +171,6 @@ struct associated_cancellation_slot_forwarding_base -struct associated_cancellation_slot, CancellationSlot> -#if !defined(GENERATING_DOCUMENTATION) - : detail::associated_cancellation_slot_forwarding_base -#endif // !defined(GENERATING_DOCUMENTATION) -{ - /// Forwards @c type to the associator specialisation for the unwrapped type - /// @c T. - typedef typename associated_cancellation_slot::type type; - - /// Forwards the request to get the cancellation slot to the associator - /// specialisation for the unwrapped type @c T. - static type get(reference_wrapper t) ASIO_NOEXCEPT - { - return associated_cancellation_slot::get(t.get()); - } - - /// Forwards the request to get the cancellation slot to the associator - /// specialisation for the unwrapped type @c T. - static ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(reference_wrapper t, - const CancellationSlot& s) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_cancellation_slot::get(t.get(), s))) - { - return associated_cancellation_slot::get(t.get(), s); - } -}; - -#endif // defined(ASIO_HAS_STD_REFERENCE_WRAPPER) - // || defined(GENERATING_DOCUMENTATION) - } // namespace asio #include "asio/detail/pop_options.hpp" diff --git a/thirdparty/asio/asio/associated_executor.hpp b/thirdparty/asio/asio/associated_executor.hpp index 61f369958..3439bc563 100644 --- a/thirdparty/asio/asio/associated_executor.hpp +++ b/thirdparty/asio/asio/associated_executor.hpp @@ -2,7 +2,7 @@ // associated_executor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -51,12 +51,7 @@ struct associated_executor_impl typedef E type; - static type get(const T&) ASIO_NOEXCEPT - { - return type(); - } - - static const type& get(const T&, const E& e) ASIO_NOEXCEPT + static type get(const T&, const E& e = E()) ASIO_NOEXCEPT { return e; } @@ -68,16 +63,7 @@ struct associated_executor_impl struct associated_executor @@ -128,13 +112,10 @@ struct associated_executor /// Otherwise @c Executor. typedef see_below type; - /// If @c T has a nested type @c executor_type, returns - /// t.get_executor(). Otherwise returns @c type(). - static decltype(auto) get(const T& t) ASIO_NOEXCEPT; - /// If @c T has a nested type @c executor_type, returns /// t.get_executor(). Otherwise returns @c ex. - static decltype(auto) get(const T& t, const Executor& ex) ASIO_NOEXCEPT; + static type get(const T& t, + const Executor& ex = Executor()) ASIO_NOEXCEPT; #endif // defined(GENERATING_DOCUMENTATION) }; @@ -154,14 +135,11 @@ get_associated_executor(const T& t) ASIO_NOEXCEPT * @returns associated_executor::get(t, ex) */ template -ASIO_NODISCARD inline ASIO_AUTO_RETURN_TYPE_PREFIX2( - typename associated_executor::type) +ASIO_NODISCARD inline typename associated_executor::type get_associated_executor(const T& t, const Executor& ex, typename constraint< is_executor::value || execution::is_executor::value >::type = 0) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_executor::get(t, ex))) { return associated_executor::get(t, ex); } @@ -172,7 +150,8 @@ get_associated_executor(const T& t, const Executor& ex, * ExecutionContext::executor_type>::get(t, ctx.get_executor()) */ template -ASIO_NODISCARD inline typename ExecutionContext::executor_type +ASIO_NODISCARD inline typename associated_executor::type get_associated_executor(const T& t, ExecutionContext& ctx, typename constraint::value>::type = 0) ASIO_NOEXCEPT @@ -226,17 +205,8 @@ struct associated_executor, Executor> /// Forwards the request to get the executor to the associator specialisation /// for the unwrapped type @c T. - static type get(reference_wrapper t) ASIO_NOEXCEPT - { - return associated_executor::get(t.get()); - } - - /// Forwards the request to get the executor to the associator specialisation - /// for the unwrapped type @c T. - static ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( - reference_wrapper t, const Executor& ex) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_executor::get(t.get(), ex))) + static type get(reference_wrapper t, + const Executor& ex = Executor()) ASIO_NOEXCEPT { return associated_executor::get(t.get(), ex); } diff --git a/thirdparty/asio/asio/associated_immediate_executor.hpp b/thirdparty/asio/asio/associated_immediate_executor.hpp deleted file mode 100644 index 2ce191584..000000000 --- a/thirdparty/asio/asio/associated_immediate_executor.hpp +++ /dev/null @@ -1,301 +0,0 @@ -// -// associated_immediate_executor.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2023 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) -// - -#ifndef ASIO_ASSOCIATED_IMMEDIATE_EXECUTOR_HPP -#define ASIO_ASSOCIATED_IMMEDIATE_EXECUTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include "asio/detail/config.hpp" -#include "asio/associator.hpp" -#include "asio/detail/functional.hpp" -#include "asio/detail/type_traits.hpp" -#include "asio/execution/blocking.hpp" -#include "asio/execution/executor.hpp" -#include "asio/execution_context.hpp" -#include "asio/is_executor.hpp" -#include "asio/require.hpp" - -#include "asio/detail/push_options.hpp" - -namespace asio { - -template -struct associated_immediate_executor; - -namespace detail { - -template -struct has_immediate_executor_type : false_type -{ -}; - -template -struct has_immediate_executor_type::type> - : true_type -{ -}; - -template -struct default_immediate_executor -{ - typedef typename require_result::type type; - - static type get(const E& e) ASIO_NOEXCEPT - { - return asio::require(e, execution::blocking.never); - } -}; - -template -struct default_immediate_executor::value - >::type, - typename enable_if< - is_executor::value - >::type> -{ - class type : public E - { - public: - template - explicit type(const Executor1& e, - typename constraint< - conditional< - !is_same::value, - is_convertible, - false_type - >::type::value - >::type = 0) ASIO_NOEXCEPT - : E(e) - { - } - - type(const type& other) ASIO_NOEXCEPT - : E(static_cast(other)) - { - } - -#if defined(ASIO_HAS_MOVE) - type(type&& other) ASIO_NOEXCEPT - : E(ASIO_MOVE_CAST(E)(other)) - { - } -#endif // defined(ASIO_HAS_MOVE) - - template - void dispatch(ASIO_MOVE_ARG(Function) f, const Allocator& a) const - { - this->post(ASIO_MOVE_CAST(Function)(f), a); - } - - friend bool operator==(const type& a, const type& b) ASIO_NOEXCEPT - { - return static_cast(a) == static_cast(b); - } - - friend bool operator!=(const type& a, const type& b) ASIO_NOEXCEPT - { - return static_cast(a) != static_cast(b); - } - }; - - static type get(const E& e) ASIO_NOEXCEPT - { - return type(e); - } -}; - -template -struct associated_immediate_executor_impl -{ - typedef void asio_associated_immediate_executor_is_unspecialised; - - typedef typename default_immediate_executor::type type; - - static ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( - const T&, const E& e) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX((default_immediate_executor::get(e))) - { - return default_immediate_executor::get(e); - } -}; - -template -struct associated_immediate_executor_impl::type> -{ - typedef typename T::immediate_executor_type type; - - static ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( - const T& t, const E&) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_immediate_executor())) - { - return t.get_immediate_executor(); - } -}; - -template -struct associated_immediate_executor_impl::value - >::type, - typename void_type< - typename associator::type - >::type> : associator -{ -}; - -} // namespace detail - -/// Traits type used to obtain the immediate executor associated with an object. -/** - * A program may specialise this traits type if the @c T template parameter in - * the specialisation is a user-defined type. The template parameter @c - * Executor shall be a type meeting the Executor requirements. - * - * Specialisations shall meet the following requirements, where @c t is a const - * reference to an object of type @c T, and @c e is an object of type @c - * Executor. - * - * @li Provide a nested typedef @c type that identifies a type meeting the - * Executor requirements. - * - * @li Provide a noexcept static member function named @c get, callable as @c - * get(t) and with return type @c type or a (possibly const) reference to @c - * type. - * - * @li Provide a noexcept static member function named @c get, callable as @c - * get(t,e) and with return type @c type or a (possibly const) reference to @c - * type. - */ -template -struct associated_immediate_executor -#if !defined(GENERATING_DOCUMENTATION) - : detail::associated_immediate_executor_impl -#endif // !defined(GENERATING_DOCUMENTATION) -{ -#if defined(GENERATING_DOCUMENTATION) - /// If @c T has a nested type @c immediate_executor_type, - // T::immediate_executor_type. Otherwise @c Executor. - typedef see_below type; - - /// If @c T has a nested type @c immediate_executor_type, returns - /// t.get_immediate_executor(). Otherwise returns - /// asio::require(ex, asio::execution::blocking.never). - static decltype(auto) get(const T& t, const Executor& ex) ASIO_NOEXCEPT; -#endif // defined(GENERATING_DOCUMENTATION) -}; - -/// Helper function to obtain an object's associated executor. -/** - * @returns associated_immediate_executor::get(t, ex) - */ -template -ASIO_NODISCARD inline ASIO_AUTO_RETURN_TYPE_PREFIX2( - typename associated_immediate_executor::type) -get_associated_immediate_executor(const T& t, const Executor& ex, - typename constraint< - is_executor::value || execution::is_executor::value - >::type = 0) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_immediate_executor::get(t, ex))) -{ - return associated_immediate_executor::get(t, ex); -} - -/// Helper function to obtain an object's associated executor. -/** - * @returns associated_immediate_executor::get(t, ctx.get_executor()) - */ -template -ASIO_NODISCARD inline ASIO_AUTO_RETURN_TYPE_PREFIX2( - typename associated_immediate_executor::type) -get_associated_immediate_executor(const T& t, ExecutionContext& ctx, - typename constraint::value>::type = 0) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_immediate_executor::get(t, ctx.get_executor()))) -{ - return associated_immediate_executor::get(t, ctx.get_executor()); -} - -#if defined(ASIO_HAS_ALIAS_TEMPLATES) - -template -using associated_immediate_executor_t = - typename associated_immediate_executor::type; - -#endif // defined(ASIO_HAS_ALIAS_TEMPLATES) - -namespace detail { - -template -struct associated_immediate_executor_forwarding_base -{ -}; - -template -struct associated_immediate_executor_forwarding_base::asio_associated_immediate_executor_is_unspecialised, - void - >::value - >::type> -{ - typedef void asio_associated_immediate_executor_is_unspecialised; -}; - -} // namespace detail - -#if defined(ASIO_HAS_STD_REFERENCE_WRAPPER) \ - || defined(GENERATING_DOCUMENTATION) - -/// Specialisation of associated_immediate_executor for -/// @c std::reference_wrapper. -template -struct associated_immediate_executor, Executor> -#if !defined(GENERATING_DOCUMENTATION) - : detail::associated_immediate_executor_forwarding_base -#endif // !defined(GENERATING_DOCUMENTATION) -{ - /// Forwards @c type to the associator specialisation for the unwrapped type - /// @c T. - typedef typename associated_immediate_executor::type type; - - /// Forwards the request to get the executor to the associator specialisation - /// for the unwrapped type @c T. - static ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( - reference_wrapper t, const Executor& ex) ASIO_NOEXCEPT - ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_immediate_executor::get(t.get(), ex))) - { - return associated_immediate_executor::get(t.get(), ex); - } -}; - -#endif // defined(ASIO_HAS_STD_REFERENCE_WRAPPER) - // || defined(GENERATING_DOCUMENTATION) - -} // namespace asio - -#include "asio/detail/pop_options.hpp" - -#endif // ASIO_ASSOCIATED_IMMEDIATE_EXECUTOR_HPP diff --git a/thirdparty/asio/asio/associator.hpp b/thirdparty/asio/asio/associator.hpp index e954c4428..1452de6a2 100644 --- a/thirdparty/asio/asio/associator.hpp +++ b/thirdparty/asio/asio/associator.hpp @@ -2,7 +2,7 @@ // associator.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/async_result.hpp b/thirdparty/asio/asio/async_result.hpp index 9ef02e16a..47fde00f5 100644 --- a/thirdparty/asio/asio/async_result.hpp +++ b/thirdparty/asio/asio/async_result.hpp @@ -2,7 +2,7 @@ // async_result.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/awaitable.hpp b/thirdparty/asio/asio/awaitable.hpp index 8511595a2..e74f64aac 100644 --- a/thirdparty/asio/asio/awaitable.hpp +++ b/thirdparty/asio/asio/awaitable.hpp @@ -2,7 +2,7 @@ // awaitable.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/basic_datagram_socket.hpp b/thirdparty/asio/asio/basic_datagram_socket.hpp index 2ec611b99..5100be8b5 100644 --- a/thirdparty/asio/asio/basic_datagram_socket.hpp +++ b/thirdparty/asio/asio/basic_datagram_socket.hpp @@ -2,7 +2,7 @@ // basic_datagram_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -1262,7 +1262,7 @@ class basic_datagram_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1296,7 +1296,7 @@ class basic_datagram_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1330,7 +1330,7 @@ class basic_datagram_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1364,7 +1364,7 @@ class basic_datagram_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_deadline_timer.hpp b/thirdparty/asio/asio/basic_deadline_timer.hpp index d0d44d0e5..e95aaacfd 100644 --- a/thirdparty/asio/asio/basic_deadline_timer.hpp +++ b/thirdparty/asio/asio/basic_deadline_timer.hpp @@ -2,7 +2,7 @@ // basic_deadline_timer.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -317,7 +317,7 @@ class basic_deadline_timer } /// Get the executor associated with the object. - const executor_type& get_executor() ASIO_NOEXCEPT + executor_type get_executor() ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -679,7 +679,7 @@ class basic_deadline_timer { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_file.hpp b/thirdparty/asio/asio/basic_file.hpp index 545335a9c..3b7cf7d18 100644 --- a/thirdparty/asio/asio/basic_file.hpp +++ b/thirdparty/asio/asio/basic_file.hpp @@ -2,7 +2,7 @@ // basic_file.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -37,8 +37,6 @@ # include "asio/detail/win_iocp_file_service.hpp" #elif defined(ASIO_HAS_IO_URING) # include "asio/detail/io_uring_file_service.hpp" -#elif defined(ASIO_HAS_LIB_AIO) -# include "asio/detail/lib_aio_file_service.hpp" #endif #if defined(ASIO_HAS_MOVE) @@ -90,8 +88,6 @@ class basic_file typedef detail::win_iocp_file_service::native_handle_type native_handle_type; #elif defined(ASIO_HAS_IO_URING) typedef detail::io_uring_file_service::native_handle_type native_handle_type; -#elif defined(ASIO_HAS_LIB_AIO) - typedef detail::lib_aio_file_service::native_handle_type native_handle_type; #endif /// Construct a basic_file without opening it. @@ -347,7 +343,7 @@ class basic_file #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the executor associated with the object. - const executor_type& get_executor() ASIO_NOEXCEPT + executor_type get_executor() ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -815,8 +811,6 @@ class basic_file detail::io_object_impl impl_; #elif defined(ASIO_HAS_IO_URING) detail::io_object_impl impl_; -#elif defined(ASIO_HAS_LIB_AIO) - detail::io_object_impl impl_; #endif private: diff --git a/thirdparty/asio/asio/basic_io_object.hpp b/thirdparty/asio/asio/basic_io_object.hpp index 6d16a2b77..92cf8c63c 100644 --- a/thirdparty/asio/asio/basic_io_object.hpp +++ b/thirdparty/asio/asio/basic_io_object.hpp @@ -2,7 +2,7 @@ // basic_io_object.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/basic_random_access_file.hpp b/thirdparty/asio/asio/basic_random_access_file.hpp index ed5b231e4..3b263d610 100644 --- a/thirdparty/asio/asio/basic_random_access_file.hpp +++ b/thirdparty/asio/asio/basic_random_access_file.hpp @@ -2,7 +2,7 @@ // basic_random_access_file.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -634,7 +634,7 @@ class basic_random_access_file { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -667,7 +667,7 @@ class basic_random_access_file { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_raw_socket.hpp b/thirdparty/asio/asio/basic_raw_socket.hpp index 50583e597..b7990daca 100644 --- a/thirdparty/asio/asio/basic_raw_socket.hpp +++ b/thirdparty/asio/asio/basic_raw_socket.hpp @@ -2,7 +2,7 @@ // basic_raw_socket.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -1253,7 +1253,7 @@ class basic_raw_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1287,7 +1287,7 @@ class basic_raw_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1321,7 +1321,7 @@ class basic_raw_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1355,7 +1355,7 @@ class basic_raw_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_readable_pipe.hpp b/thirdparty/asio/asio/basic_readable_pipe.hpp index b774e1c22..555420e9e 100644 --- a/thirdparty/asio/asio/basic_readable_pipe.hpp +++ b/thirdparty/asio/asio/basic_readable_pipe.hpp @@ -2,7 +2,7 @@ // basic_readable_pipe.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -263,7 +263,7 @@ class basic_readable_pipe } /// Get the executor associated with the object. - const executor_type& get_executor() ASIO_NOEXCEPT + executor_type get_executor() ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -593,7 +593,7 @@ class basic_readable_pipe { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_seq_packet_socket.hpp b/thirdparty/asio/asio/basic_seq_packet_socket.hpp index b81ab88ac..1adcf82b4 100644 --- a/thirdparty/asio/asio/basic_seq_packet_socket.hpp +++ b/thirdparty/asio/asio/basic_seq_packet_socket.hpp @@ -2,7 +2,7 @@ // basic_seq_packet_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -768,7 +768,7 @@ class basic_seq_packet_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -802,7 +802,7 @@ class basic_seq_packet_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_serial_port.hpp b/thirdparty/asio/asio/basic_serial_port.hpp index 59d5d363d..941386542 100644 --- a/thirdparty/asio/asio/basic_serial_port.hpp +++ b/thirdparty/asio/asio/basic_serial_port.hpp @@ -2,7 +2,7 @@ // basic_serial_port.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -353,7 +353,7 @@ class basic_serial_port } /// Get the executor associated with the object. - const executor_type& get_executor() ASIO_NOEXCEPT + executor_type get_executor() ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -927,7 +927,7 @@ class basic_serial_port { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -960,7 +960,7 @@ class basic_serial_port { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_signal_set.hpp b/thirdparty/asio/asio/basic_signal_set.hpp index f298049cb..7cdb9d42b 100644 --- a/thirdparty/asio/asio/basic_signal_set.hpp +++ b/thirdparty/asio/asio/basic_signal_set.hpp @@ -2,7 +2,7 @@ // basic_signal_set.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -333,7 +333,7 @@ class basic_signal_set } /// Get the executor associated with the object. - const executor_type& get_executor() ASIO_NOEXCEPT + executor_type get_executor() ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -566,7 +566,7 @@ class basic_signal_set { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_socket.hpp b/thirdparty/asio/asio/basic_socket.hpp index b2c8e499b..29986a02d 100644 --- a/thirdparty/asio/asio/basic_socket.hpp +++ b/thirdparty/asio/asio/basic_socket.hpp @@ -2,7 +2,7 @@ // basic_socket.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -373,7 +373,7 @@ class basic_socket #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the executor associated with the object. - const executor_type& get_executor() ASIO_NOEXCEPT + executor_type get_executor() ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -1874,7 +1874,7 @@ class basic_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1917,7 +1917,7 @@ class basic_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_socket_acceptor.hpp b/thirdparty/asio/asio/basic_socket_acceptor.hpp index 928104145..b2667d0a8 100644 --- a/thirdparty/asio/asio/basic_socket_acceptor.hpp +++ b/thirdparty/asio/asio/basic_socket_acceptor.hpp @@ -2,7 +2,7 @@ // basic_socket_acceptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -454,7 +454,7 @@ class basic_socket_acceptor } /// Get the executor associated with the object. - const executor_type& get_executor() ASIO_NOEXCEPT + executor_type get_executor() ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -2639,7 +2639,7 @@ class basic_socket_acceptor { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -2671,7 +2671,7 @@ class basic_socket_acceptor { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -2705,7 +2705,7 @@ class basic_socket_acceptor { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_socket_iostream.hpp b/thirdparty/asio/asio/basic_socket_iostream.hpp index 13e73eb43..0ba923285 100644 --- a/thirdparty/asio/asio/basic_socket_iostream.hpp +++ b/thirdparty/asio/asio/basic_socket_iostream.hpp @@ -2,7 +2,7 @@ // basic_socket_iostream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/basic_socket_streambuf.hpp b/thirdparty/asio/asio/basic_socket_streambuf.hpp index cdfb24a85..f144907ba 100644 --- a/thirdparty/asio/asio/basic_socket_streambuf.hpp +++ b/thirdparty/asio/asio/basic_socket_streambuf.hpp @@ -2,7 +2,7 @@ // basic_socket_streambuf.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/basic_stream_file.hpp b/thirdparty/asio/asio/basic_stream_file.hpp index af47d0d1d..f6f21ccee 100644 --- a/thirdparty/asio/asio/basic_stream_file.hpp +++ b/thirdparty/asio/asio/basic_stream_file.hpp @@ -2,7 +2,7 @@ // basic_stream_file.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -687,7 +687,7 @@ class basic_stream_file { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -720,7 +720,7 @@ class basic_stream_file { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_stream_socket.hpp b/thirdparty/asio/asio/basic_stream_socket.hpp index afe7c765b..1c6e5dd74 100644 --- a/thirdparty/asio/asio/basic_stream_socket.hpp +++ b/thirdparty/asio/asio/basic_stream_socket.hpp @@ -2,7 +2,7 @@ // basic_stream_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -1123,7 +1123,7 @@ class basic_stream_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1157,7 +1157,7 @@ class basic_stream_socket { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_streambuf.hpp b/thirdparty/asio/asio/basic_streambuf.hpp index 61e6dc4c3..7b6068838 100644 --- a/thirdparty/asio/asio/basic_streambuf.hpp +++ b/thirdparty/asio/asio/basic_streambuf.hpp @@ -2,7 +2,7 @@ // basic_streambuf.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/basic_streambuf_fwd.hpp b/thirdparty/asio/asio/basic_streambuf_fwd.hpp index 2f74881e3..25ce8297b 100644 --- a/thirdparty/asio/asio/basic_streambuf_fwd.hpp +++ b/thirdparty/asio/asio/basic_streambuf_fwd.hpp @@ -2,7 +2,7 @@ // basic_streambuf_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) diff --git a/thirdparty/asio/asio/basic_waitable_timer.hpp b/thirdparty/asio/asio/basic_waitable_timer.hpp index dccb546ac..9c6e33cde 100644 --- a/thirdparty/asio/asio/basic_waitable_timer.hpp +++ b/thirdparty/asio/asio/basic_waitable_timer.hpp @@ -2,7 +2,7 @@ // basic_waitable_timer.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -381,7 +381,7 @@ class basic_waitable_timer } /// Get the executor associated with the object. - const executor_type& get_executor() ASIO_NOEXCEPT + executor_type get_executor() ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -798,7 +798,7 @@ class basic_waitable_timer { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/basic_writable_pipe.hpp b/thirdparty/asio/asio/basic_writable_pipe.hpp index 3c305fa9b..615cd018f 100644 --- a/thirdparty/asio/asio/basic_writable_pipe.hpp +++ b/thirdparty/asio/asio/basic_writable_pipe.hpp @@ -2,7 +2,7 @@ // basic_writable_pipe.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -263,7 +263,7 @@ class basic_writable_pipe } /// Get the executor associated with the object. - const executor_type& get_executor() ASIO_NOEXCEPT + executor_type get_executor() ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -589,7 +589,7 @@ class basic_writable_pipe { } - const executor_type& get_executor() const ASIO_NOEXCEPT + executor_type get_executor() const ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/thirdparty/asio/asio/bind_allocator.hpp b/thirdparty/asio/asio/bind_allocator.hpp index 03fc2c5de..fa83b3d45 100644 --- a/thirdparty/asio/asio/bind_allocator.hpp +++ b/thirdparty/asio/asio/bind_allocator.hpp @@ -2,7 +2,7 @@ // bind_allocator.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2022 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) @@ -689,20 +689,11 @@ template