passenger 6.0.16 → 6.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +22 -1
- data/build/integration_tests.rb +6 -6
- data/build/ruby_tests.rb +1 -1
- data/build/test_basics.rb +0 -1
- data/src/agent/Core/Config.h +1 -1
- data/src/agent/Core/Controller/Config.h +1 -1
- data/src/agent/Core/SpawningKit/PipeWatcher.h +18 -3
- data/src/agent/Watchdog/Config.h +1 -1
- data/src/cxx_supportlib/Constants.h +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/align/aligned_alloc.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/array.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/any_completion_executor.hpp +344 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/any_completion_handler.hpp +686 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/any_io_executor.hpp +56 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/associated_allocator.hpp +81 -25
- data/src/cxx_supportlib/vendor-modified/boost/asio/associated_cancellation_slot.hpp +68 -8
- data/src/cxx_supportlib/vendor-modified/boost/asio/associated_executor.hpp +46 -11
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_datagram_socket.hpp +4 -4
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_deadline_timer.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_file.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_random_access_file.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_raw_socket.hpp +4 -4
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_readable_pipe.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_seq_packet_socket.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_serial_port.hpp +3 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_signal_set.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket.hpp +3 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_acceptor.hpp +4 -4
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_stream_file.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_stream_socket.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_waitable_timer.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/basic_writable_pipe.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/bind_allocator.hpp +13 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/bind_cancellation_slot.hpp +14 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/bind_executor.hpp +13 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/compose.hpp +30 -305
- data/src/cxx_supportlib/vendor-modified/boost/asio/consign.hpp +90 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/defer.hpp +17 -18
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/bind_handler.hpp +98 -24
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/composed_work.hpp +330 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/config.hpp +81 -15
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_alloc_helpers.hpp +4 -4
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_work.hpp +19 -11
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/descriptor_ops.ipp +37 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/handler_tracking.ipp +3 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/select_reactor.ipp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/socket_ops.ipp +10 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/strand_executor_service.hpp +14 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/memory.hpp +18 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/utility.hpp +1 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/detail/work_dispatcher.hpp +7 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/dispatch.hpp +4 -14
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/allocator.hpp +22 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/any_executor.hpp +447 -142
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/blocking.hpp +57 -8
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/blocking_adaptation.hpp +51 -6
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/bulk_execute.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/bulk_guarantee.hpp +41 -4
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/connect.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/context.hpp +13 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/context_as.hpp +13 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/detail/as_operation.hpp +4 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/execute.hpp +9 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/executor.hpp +11 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/mapping.hpp +52 -8
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/occupancy.hpp +13 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/operation_state.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/outstanding_work.hpp +39 -6
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/receiver.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/relationship.hpp +39 -6
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/schedule.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/scheduler.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/sender.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/set_done.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/set_error.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/set_value.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/start.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/execution/submit.hpp +5 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/executor_work_guard.hpp +6 -9
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/basic_channel.hpp +3 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/basic_concurrent_channel.hpp +3 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/channel_traits.hpp +70 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/co_composed.hpp +146 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/coro.hpp +35 -5
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_handler.hpp +13 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_operation.hpp +7 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_service.hpp +180 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/coro_completion_handler.hpp +171 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/coro_promise_allocator.hpp +89 -66
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/partial_promise.hpp +66 -45
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/as_single.hpp +13 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/co_composed.hpp +1134 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/coro.hpp +130 -106
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/parallel_group.hpp +377 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/promise.hpp +168 -29
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/use_coro.hpp +149 -203
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/use_promise.hpp +68 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/parallel_group.hpp +256 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/promise.hpp +76 -80
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/use_coro.hpp +40 -14
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/use_promise.hpp +113 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/any_completion_executor.ipp +132 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/any_io_executor.ipp +12 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/append.hpp +12 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/as_tuple.hpp +12 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/buffered_read_stream.hpp +25 -6
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/buffered_write_stream.hpp +25 -6
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/co_spawn.hpp +34 -45
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/connect.hpp +28 -6
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/consign.hpp +204 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/defer.hpp +33 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/deferred.hpp +13 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/dispatch.hpp +21 -9
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/handler_alloc_hook.ipp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/post.hpp +33 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/prepend.hpp +12 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read.hpp +40 -9
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_at.hpp +27 -6
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_until.hpp +104 -24
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/redirect_error.hpp +12 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/spawn.hpp +70 -15
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/src.hpp +1 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/use_future.hpp +25 -0
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write.hpp +38 -30
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write_at.hpp +27 -6
- data/src/cxx_supportlib/vendor-modified/boost/asio/io_context.hpp +0 -13
- data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/network_v4.ipp +3 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/network_v6.ipp +3 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_descriptor.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_stream_descriptor.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/post.hpp +17 -18
- data/src/cxx_supportlib/vendor-modified/boost/asio/spawn.hpp +3 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/io.hpp +13 -3
- data/src/cxx_supportlib/vendor-modified/boost/asio/strand.hpp +11 -7
- data/src/cxx_supportlib/vendor-modified/boost/asio/system_executor.hpp +0 -13
- data/src/cxx_supportlib/vendor-modified/boost/asio/thread_pool.hpp +23 -18
- data/src/cxx_supportlib/vendor-modified/boost/asio/version.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_object_handle.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_overlapped_handle.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_random_access_handle.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_stream_handle.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/asio.hpp +4 -0
- data/src/cxx_supportlib/vendor-modified/boost/bind/bind.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/chrono/config.hpp +1 -0
- data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/mac/chrono.hpp +4 -4
- data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/scan_keyword.hpp +4 -2
- data/src/cxx_supportlib/vendor-modified/boost/chrono/duration.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_io.hpp +3 -3
- data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_put.hpp +5 -5
- data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_units.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/chrono/io/time_point_io.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/chrono/io/utility/ios_base_state_ptr.hpp +7 -7
- data/src/cxx_supportlib/vendor-modified/boost/chrono/time_point.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/details.hpp +5 -1
- data/src/cxx_supportlib/vendor-modified/boost/config/compiler/clang.hpp +10 -3
- data/src/cxx_supportlib/vendor-modified/boost/config/compiler/clang_version.hpp +9 -3
- data/src/cxx_supportlib/vendor-modified/boost/config/compiler/gcc.hpp +9 -3
- data/src/cxx_supportlib/vendor-modified/boost/config/compiler/sunpro_cc.hpp +6 -0
- data/src/cxx_supportlib/vendor-modified/boost/config/compiler/visualc.hpp +8 -0
- data/src/cxx_supportlib/vendor-modified/boost/config/compiler/xlcpp.hpp +4 -0
- data/src/cxx_supportlib/vendor-modified/boost/config/detail/suffix.hpp +33 -0
- data/src/cxx_supportlib/vendor-modified/boost/config/header_deprecated.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/libcpp.hpp +9 -0
- data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/libstdcpp3.hpp +4 -2
- data/src/cxx_supportlib/vendor-modified/boost/container/allocator.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/container/container_fwd.hpp +29 -0
- data/src/cxx_supportlib/vendor-modified/boost/container/deque.hpp +13 -13
- data/src/cxx_supportlib/vendor-modified/boost/container/detail/advanced_insert_int.hpp +80 -95
- data/src/cxx_supportlib/vendor-modified/boost/container/detail/config_begin.hpp +10 -0
- data/src/cxx_supportlib/vendor-modified/boost/container/detail/config_end.hpp +3 -0
- data/src/cxx_supportlib/vendor-modified/boost/container/detail/copy_move_algo.hpp +738 -34
- data/src/cxx_supportlib/vendor-modified/boost/container/detail/destroyers.hpp +38 -10
- data/src/cxx_supportlib/vendor-modified/boost/container/detail/flat_tree.hpp +1 -0
- data/src/cxx_supportlib/vendor-modified/boost/container/detail/iterator.hpp +2 -0
- data/src/cxx_supportlib/vendor-modified/boost/container/detail/workaround.hpp +3 -4
- data/src/cxx_supportlib/vendor-modified/boost/container/devector.hpp +1150 -1213
- data/src/cxx_supportlib/vendor-modified/boost/container/node_allocator.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/container/options.hpp +104 -12
- data/src/cxx_supportlib/vendor-modified/boost/container/stable_vector.hpp +1 -0
- data/src/cxx_supportlib/vendor-modified/boost/container/string.hpp +11 -1
- data/src/cxx_supportlib/vendor-modified/boost/container/vector.hpp +31 -331
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/hash_mix.hpp +113 -0
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/hash_range.hpp +173 -0
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/hash_tuple.hpp +133 -0
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/hash.hpp +461 -566
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/hash_fwd.hpp +24 -24
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/is_contiguous_range.hpp +91 -0
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/is_described_class.hpp +38 -0
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/is_range.hpp +73 -0
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/is_unordered_range.hpp +39 -0
- data/src/cxx_supportlib/vendor-modified/boost/core/bit.hpp +32 -4
- data/src/cxx_supportlib/vendor-modified/boost/core/detail/string_view.hpp +16 -0
- data/src/cxx_supportlib/vendor-modified/boost/core/empty_value.hpp +16 -16
- data/src/cxx_supportlib/vendor-modified/boost/core/fclose_deleter.hpp +46 -0
- data/src/cxx_supportlib/vendor-modified/boost/date_time/date.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/formatters.hpp +3 -3
- data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/formatters_limited.hpp +3 -3
- data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/greg_date.hpp +12 -13
- data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/parsers.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian_calendar.ipp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/date_time/iso_format.hpp +13 -13
- data/src/cxx_supportlib/vendor-modified/boost/date_time/local_time/local_date_time.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/date_time/posix_time/time_formatters.hpp +4 -4
- data/src/cxx_supportlib/vendor-modified/boost/date_time/posix_time/time_formatters_limited.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/date_time/special_values_parser.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/date_time/time_facet.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/date_time/time_parsing.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/describe/bases.hpp +50 -0
- data/src/cxx_supportlib/vendor-modified/boost/describe/detail/config.hpp +40 -0
- data/src/cxx_supportlib/vendor-modified/boost/describe/detail/cx_streq.hpp +30 -0
- data/src/cxx_supportlib/vendor-modified/boost/describe/detail/void_t.hpp +32 -0
- data/src/cxx_supportlib/vendor-modified/boost/describe/members.hpp +159 -0
- data/src/cxx_supportlib/vendor-modified/boost/describe/modifiers.hpp +33 -0
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/avltree_algorithms.hpp +9 -9
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/bstree_algorithms.hpp +45 -45
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/any_node_and_algorithms.hpp +8 -8
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/bstree_algorithms_base.hpp +37 -38
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/iterator.hpp +16 -0
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/workaround.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/hashtable.hpp +145 -90
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/pack_options.hpp +2 -0
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/rbtree_algorithms.hpp +7 -7
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/sgtree_algorithms.hpp +5 -5
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/splaytree_algorithms.hpp +11 -9
- data/src/cxx_supportlib/vendor-modified/boost/intrusive/treap_algorithms.hpp +7 -7
- data/src/cxx_supportlib/vendor-modified/boost/iterator/iterator_facade.hpp +106 -25
- data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical_streams.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_numeric.hpp +8 -5
- data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/adaptive_sort_merge.hpp +4 -2
- data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/pdqsort.hpp +2 -1
- data/src/cxx_supportlib/vendor-modified/boost/move/detail/type_traits.hpp +8 -4
- data/src/cxx_supportlib/vendor-modified/boost/mp11/bind.hpp +111 -0
- data/src/cxx_supportlib/vendor-modified/boost/mp11/version.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/numeric/conversion/detail/int_float_mixture.hpp +5 -5
- data/src/cxx_supportlib/vendor-modified/boost/numeric/conversion/detail/sign_mixture.hpp +5 -5
- data/src/cxx_supportlib/vendor-modified/boost/numeric/conversion/detail/udt_builtin_mixture.hpp +5 -5
- data/src/cxx_supportlib/vendor-modified/boost/preprocessor/variadic/has_opt.hpp +6 -2
- data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp +11 -2
- data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/intrusive_ptr.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/system/detail/config.hpp +7 -1
- data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_category.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_category_impl.hpp +10 -1
- data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_code.hpp +38 -43
- data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_condition.hpp +52 -0
- data/src/cxx_supportlib/vendor-modified/boost/throw_exception.hpp +1 -1
- data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_function_ptr_helper.hpp +27 -27
- data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp +27 -27
- data/src/cxx_supportlib/vendor-modified/boost/type_traits/intrinsics.hpp +22 -8
- data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/fca.hpp +37 -7
- data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa.hpp +1921 -0
- data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/implementation.hpp +66 -82
- data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/prime_fmod.hpp +6 -0
- data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/type_traits.hpp +109 -0
- data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/xmx.hpp +75 -0
- data/src/cxx_supportlib/vendor-modified/boost/unordered/hash_traits.hpp +45 -0
- data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_map.hpp +732 -0
- data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_map_fwd.hpp +49 -0
- data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_set.hpp +586 -0
- data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_set_fwd.hpp +49 -0
- data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_map.hpp +166 -66
- data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_set.hpp +145 -28
- data/src/cxx_supportlib/vendor-modified/boost/version.hpp +2 -2
- data/src/cxx_supportlib/vendor-modified/websocketpp/websocketpp/common/md5.hpp +1 -1
- data/src/ruby_native_extension/extconf.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger.rb +5 -5
- metadata +36 -19
- data/src/cxx_supportlib/vendor-modified/boost/align/align.hpp +0 -19
- data/src/cxx_supportlib/vendor-modified/boost/align/alignment_of.hpp +0 -54
- data/src/cxx_supportlib/vendor-modified/boost/align/alignment_of_forward.hpp +0 -20
- data/src/cxx_supportlib/vendor-modified/boost/align/detail/align_cxx11.hpp +0 -21
- data/src/cxx_supportlib/vendor-modified/boost/align/detail/aligned_alloc.hpp +0 -52
- data/src/cxx_supportlib/vendor-modified/boost/align/detail/alignment_of.hpp +0 -31
- data/src/cxx_supportlib/vendor-modified/boost/align/detail/alignment_of_cxx11.hpp +0 -23
- data/src/cxx_supportlib/vendor-modified/boost/align/detail/element_type.hpp +0 -91
- data/src/cxx_supportlib/vendor-modified/boost/align/detail/integral_constant.hpp +0 -53
- data/src/cxx_supportlib/vendor-modified/boost/align/detail/min_size.hpp +0 -26
- data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/completion_handler_erasure.hpp +0 -196
- data/src/cxx_supportlib/vendor-modified/boost/asio/impl/compose.hpp +0 -709
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/float_functions.hpp +0 -336
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/hash_float.hpp +0 -271
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/limits.hpp +0 -62
- data/src/cxx_supportlib/vendor-modified/boost/container_hash/extensions.hpp +0 -361
- data/src/cxx_supportlib/vendor-modified/boost/detail/container_fwd.hpp +0 -157
@@ -0,0 +1,1134 @@
|
|
1
|
+
//
|
2
|
+
// experimental/impl/co_composed.hpp
|
3
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
4
|
+
//
|
5
|
+
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
6
|
+
//
|
7
|
+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
8
|
+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
9
|
+
//
|
10
|
+
|
11
|
+
#ifndef BOOST_ASIO_IMPL_EXPERIMENTAL_CO_COMPOSED_HPP
|
12
|
+
#define BOOST_ASIO_IMPL_EXPERIMENTAL_CO_COMPOSED_HPP
|
13
|
+
|
14
|
+
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
15
|
+
# pragma once
|
16
|
+
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
17
|
+
|
18
|
+
#include <boost/asio/detail/config.hpp>
|
19
|
+
#include <new>
|
20
|
+
#include <tuple>
|
21
|
+
#include <variant>
|
22
|
+
#include <boost/asio/associated_cancellation_slot.hpp>
|
23
|
+
#include <boost/asio/associator.hpp>
|
24
|
+
#include <boost/asio/async_result.hpp>
|
25
|
+
#include <boost/asio/cancellation_state.hpp>
|
26
|
+
#include <boost/asio/detail/composed_work.hpp>
|
27
|
+
#include <boost/asio/detail/recycling_allocator.hpp>
|
28
|
+
#include <boost/asio/detail/throw_error.hpp>
|
29
|
+
#include <boost/asio/detail/type_traits.hpp>
|
30
|
+
#include <boost/asio/error.hpp>
|
31
|
+
|
32
|
+
#if defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
33
|
+
# include <coroutine>
|
34
|
+
#else // defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
35
|
+
# include <experimental/coroutine>
|
36
|
+
#endif // defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
37
|
+
|
38
|
+
#include <boost/asio/detail/push_options.hpp>
|
39
|
+
|
40
|
+
namespace boost {
|
41
|
+
namespace asio {
|
42
|
+
namespace experimental {
|
43
|
+
namespace detail {
|
44
|
+
|
45
|
+
#if defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
46
|
+
using std::coroutine_handle;
|
47
|
+
using std::suspend_always;
|
48
|
+
using std::suspend_never;
|
49
|
+
#else // defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
50
|
+
using std::experimental::coroutine_handle;
|
51
|
+
using std::experimental::suspend_always;
|
52
|
+
using std::experimental::suspend_never;
|
53
|
+
#endif // defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
54
|
+
|
55
|
+
using boost::asio::detail::composed_io_executors;
|
56
|
+
using boost::asio::detail::composed_work;
|
57
|
+
using boost::asio::detail::composed_work_guard;
|
58
|
+
using boost::asio::detail::get_composed_io_executor;
|
59
|
+
using boost::asio::detail::make_composed_io_executors;
|
60
|
+
using boost::asio::detail::recycling_allocator;
|
61
|
+
using boost::asio::detail::throw_error;
|
62
|
+
|
63
|
+
template <typename Executors, typename Handler, typename Return>
|
64
|
+
class co_composed_state;
|
65
|
+
|
66
|
+
template <typename Executors, typename Handler, typename Return>
|
67
|
+
class co_composed_handler_base;
|
68
|
+
|
69
|
+
template <typename Executors, typename Handler, typename Return>
|
70
|
+
class co_composed_promise;
|
71
|
+
|
72
|
+
template <completion_signature... Signatures>
|
73
|
+
class co_composed_returns
|
74
|
+
{
|
75
|
+
};
|
76
|
+
|
77
|
+
struct co_composed_on_suspend
|
78
|
+
{
|
79
|
+
void (*fn_)(void*) = nullptr;
|
80
|
+
void* arg_ = nullptr;
|
81
|
+
};
|
82
|
+
|
83
|
+
template <typename... T>
|
84
|
+
struct co_composed_completion : std::tuple<T&&...>
|
85
|
+
{
|
86
|
+
template <typename... U>
|
87
|
+
co_composed_completion(U&&... u) noexcept
|
88
|
+
: std::tuple<T&&...>(std::forward<U>(u)...)
|
89
|
+
{
|
90
|
+
}
|
91
|
+
};
|
92
|
+
|
93
|
+
template <typename Executors, typename Handler,
|
94
|
+
typename Return, typename Signature>
|
95
|
+
class co_composed_state_return_overload;
|
96
|
+
|
97
|
+
template <typename Executors, typename Handler,
|
98
|
+
typename Return, typename R, typename... Args>
|
99
|
+
class co_composed_state_return_overload<
|
100
|
+
Executors, Handler, Return, R(Args...)>
|
101
|
+
{
|
102
|
+
public:
|
103
|
+
using derived_type = co_composed_state<Executors, Handler, Return>;
|
104
|
+
using promise_type = co_composed_promise<Executors, Handler, Return>;
|
105
|
+
using return_type = std::tuple<Args...>;
|
106
|
+
|
107
|
+
void on_cancellation_complete_with(Args... args)
|
108
|
+
{
|
109
|
+
derived_type& state = *static_cast<derived_type*>(this);
|
110
|
+
state.return_value_ = std::make_tuple(std::move(args)...);
|
111
|
+
state.cancellation_on_suspend_fn(
|
112
|
+
[](void* p)
|
113
|
+
{
|
114
|
+
auto& promise = *static_cast<promise_type*>(p);
|
115
|
+
|
116
|
+
co_composed_handler_base<Executors, Handler,
|
117
|
+
Return> composed_handler(promise);
|
118
|
+
|
119
|
+
Handler handler(std::move(promise.state().handler_));
|
120
|
+
return_type result(
|
121
|
+
std::move(std::get<return_type>(promise.state().return_value_)));
|
122
|
+
|
123
|
+
co_composed_handler_base<Executors, Handler,
|
124
|
+
Return>(std::move(composed_handler));
|
125
|
+
|
126
|
+
std::apply(std::move(handler), std::move(result));
|
127
|
+
});
|
128
|
+
}
|
129
|
+
};
|
130
|
+
|
131
|
+
template <typename Executors, typename Handler, typename Return>
|
132
|
+
class co_composed_state_return;
|
133
|
+
|
134
|
+
template <typename Executors, typename Handler, typename... Signatures>
|
135
|
+
class co_composed_state_return<
|
136
|
+
Executors, Handler, co_composed_returns<Signatures...>>
|
137
|
+
: public co_composed_state_return_overload<Executors,
|
138
|
+
Handler, co_composed_returns<Signatures...>, Signatures>...
|
139
|
+
{
|
140
|
+
public:
|
141
|
+
using co_composed_state_return_overload<Executors,
|
142
|
+
Handler, co_composed_returns<Signatures...>,
|
143
|
+
Signatures>::on_cancellation_complete_with...;
|
144
|
+
|
145
|
+
private:
|
146
|
+
template <typename, typename, typename, typename>
|
147
|
+
friend class co_composed_promise_return_overload;
|
148
|
+
template <typename, typename, typename, typename>
|
149
|
+
friend class co_composed_state_return_overload;
|
150
|
+
|
151
|
+
std::variant<std::monostate,
|
152
|
+
typename co_composed_state_return_overload<
|
153
|
+
Executors, Handler, co_composed_returns<Signatures...>,
|
154
|
+
Signatures>::return_type...> return_value_;
|
155
|
+
};
|
156
|
+
|
157
|
+
template <typename Executors, typename Handler,
|
158
|
+
typename Return, typename... Signatures>
|
159
|
+
struct co_composed_state_default_cancellation_on_suspend_impl;
|
160
|
+
|
161
|
+
template <typename Executors, typename Handler, typename Return>
|
162
|
+
struct co_composed_state_default_cancellation_on_suspend_impl<
|
163
|
+
Executors, Handler, Return>
|
164
|
+
{
|
165
|
+
static constexpr void (*fn())(void*)
|
166
|
+
{
|
167
|
+
return nullptr;
|
168
|
+
}
|
169
|
+
};
|
170
|
+
|
171
|
+
template <typename Executors, typename Handler, typename Return,
|
172
|
+
typename R, typename... Args, typename... Signatures>
|
173
|
+
struct co_composed_state_default_cancellation_on_suspend_impl<
|
174
|
+
Executors, Handler, Return, R(Args...), Signatures...>
|
175
|
+
{
|
176
|
+
static constexpr void (*fn())(void*)
|
177
|
+
{
|
178
|
+
return co_composed_state_default_cancellation_on_suspend_impl<
|
179
|
+
Executors, Handler, Return, Signatures...>::fn();
|
180
|
+
}
|
181
|
+
};
|
182
|
+
|
183
|
+
template <typename Executors, typename Handler, typename Return,
|
184
|
+
typename R, typename... Args, typename... Signatures>
|
185
|
+
struct co_composed_state_default_cancellation_on_suspend_impl<Executors,
|
186
|
+
Handler, Return, R(boost::system::error_code, Args...), Signatures...>
|
187
|
+
{
|
188
|
+
using promise_type = co_composed_promise<Executors, Handler, Return>;
|
189
|
+
using return_type = std::tuple<boost::system::error_code, Args...>;
|
190
|
+
|
191
|
+
static constexpr void (*fn())(void*)
|
192
|
+
{
|
193
|
+
if constexpr ((is_constructible<Args>::value && ...))
|
194
|
+
{
|
195
|
+
return [](void* p)
|
196
|
+
{
|
197
|
+
auto& promise = *static_cast<promise_type*>(p);
|
198
|
+
|
199
|
+
co_composed_handler_base<Executors, Handler,
|
200
|
+
Return> composed_handler(promise);
|
201
|
+
|
202
|
+
Handler handler(std::move(promise.state().handler_));
|
203
|
+
|
204
|
+
co_composed_handler_base<Executors, Handler,
|
205
|
+
Return>(std::move(composed_handler));
|
206
|
+
|
207
|
+
std::move(handler)(
|
208
|
+
boost::system::error_code(boost::asio::error::operation_aborted),
|
209
|
+
Args{}...);
|
210
|
+
};
|
211
|
+
}
|
212
|
+
else
|
213
|
+
{
|
214
|
+
return co_composed_state_default_cancellation_on_suspend_impl<
|
215
|
+
Executors, Handler, Return, Signatures...>::fn();
|
216
|
+
}
|
217
|
+
}
|
218
|
+
};
|
219
|
+
|
220
|
+
template <typename Executors, typename Handler, typename Return,
|
221
|
+
typename R, typename... Args, typename... Signatures>
|
222
|
+
struct co_composed_state_default_cancellation_on_suspend_impl<Executors,
|
223
|
+
Handler, Return, R(std::exception_ptr, Args...), Signatures...>
|
224
|
+
{
|
225
|
+
using promise_type = co_composed_promise<Executors, Handler, Return>;
|
226
|
+
using return_type = std::tuple<std::exception_ptr, Args...>;
|
227
|
+
|
228
|
+
static constexpr void (*fn())(void*)
|
229
|
+
{
|
230
|
+
if constexpr ((is_constructible<Args>::value && ...))
|
231
|
+
{
|
232
|
+
return [](void* p)
|
233
|
+
{
|
234
|
+
auto& promise = *static_cast<promise_type*>(p);
|
235
|
+
|
236
|
+
co_composed_handler_base<Executors, Handler,
|
237
|
+
Return> composed_handler(promise);
|
238
|
+
|
239
|
+
Handler handler(std::move(promise.state().handler_));
|
240
|
+
|
241
|
+
co_composed_handler_base<Executors, Handler,
|
242
|
+
Return>(std::move(composed_handler));
|
243
|
+
|
244
|
+
std::move(handler)(
|
245
|
+
std::make_exception_ptr(
|
246
|
+
boost::system::system_error(
|
247
|
+
boost::asio::error::operation_aborted, "co_await")),
|
248
|
+
Args{}...);
|
249
|
+
};
|
250
|
+
}
|
251
|
+
else
|
252
|
+
{
|
253
|
+
return co_composed_state_default_cancellation_on_suspend_impl<
|
254
|
+
Executors, Handler, Return, Signatures...>::fn();
|
255
|
+
}
|
256
|
+
}
|
257
|
+
};
|
258
|
+
|
259
|
+
template <typename Executors, typename Handler, typename Return>
|
260
|
+
struct co_composed_state_default_cancellation_on_suspend;
|
261
|
+
|
262
|
+
template <typename Executors, typename Handler, typename... Signatures>
|
263
|
+
struct co_composed_state_default_cancellation_on_suspend<
|
264
|
+
Executors, Handler, co_composed_returns<Signatures...>>
|
265
|
+
: co_composed_state_default_cancellation_on_suspend_impl<Executors,
|
266
|
+
Handler, co_composed_returns<Signatures...>, Signatures...>
|
267
|
+
{
|
268
|
+
};
|
269
|
+
|
270
|
+
template <typename Executors, typename Handler, typename Return>
|
271
|
+
class co_composed_state_cancellation
|
272
|
+
{
|
273
|
+
public:
|
274
|
+
using cancellation_slot_type = cancellation_slot;
|
275
|
+
|
276
|
+
cancellation_slot_type get_cancellation_slot() const noexcept
|
277
|
+
{
|
278
|
+
return cancellation_state_.slot();
|
279
|
+
}
|
280
|
+
|
281
|
+
cancellation_state get_cancellation_state() const noexcept
|
282
|
+
{
|
283
|
+
return cancellation_state_;
|
284
|
+
}
|
285
|
+
|
286
|
+
void reset_cancellation_state()
|
287
|
+
{
|
288
|
+
cancellation_state_ = cancellation_state(
|
289
|
+
(get_associated_cancellation_slot)(
|
290
|
+
static_cast<co_composed_state<Executors, Handler, Return>*>(
|
291
|
+
this)->handler()));
|
292
|
+
}
|
293
|
+
|
294
|
+
template <typename Filter>
|
295
|
+
void reset_cancellation_state(Filter filter)
|
296
|
+
{
|
297
|
+
cancellation_state_ = cancellation_state(
|
298
|
+
(get_associated_cancellation_slot)(
|
299
|
+
static_cast<co_composed_state<Executors, Handler, Return>*>(
|
300
|
+
this)->handler()), filter, filter);
|
301
|
+
}
|
302
|
+
|
303
|
+
template <typename InFilter, typename OutFilter>
|
304
|
+
void reset_cancellation_state(InFilter&& in_filter, OutFilter&& out_filter)
|
305
|
+
{
|
306
|
+
cancellation_state_ = cancellation_state(
|
307
|
+
(get_associated_cancellation_slot)(
|
308
|
+
static_cast<co_composed_state<Executors, Handler, Return>*>(
|
309
|
+
this)->handler()),
|
310
|
+
std::forward<InFilter>(in_filter),
|
311
|
+
std::forward<OutFilter>(out_filter));
|
312
|
+
}
|
313
|
+
|
314
|
+
cancellation_type_t cancelled() const noexcept
|
315
|
+
{
|
316
|
+
return cancellation_state_.cancelled();
|
317
|
+
}
|
318
|
+
|
319
|
+
void clear_cancellation_slot() noexcept
|
320
|
+
{
|
321
|
+
cancellation_state_.slot().clear();
|
322
|
+
}
|
323
|
+
|
324
|
+
[[nodiscard]] bool throw_if_cancelled() const noexcept
|
325
|
+
{
|
326
|
+
return throw_if_cancelled_;
|
327
|
+
}
|
328
|
+
|
329
|
+
void throw_if_cancelled(bool b) noexcept
|
330
|
+
{
|
331
|
+
throw_if_cancelled_ = b;
|
332
|
+
}
|
333
|
+
|
334
|
+
[[nodiscard]] bool complete_if_cancelled() const noexcept
|
335
|
+
{
|
336
|
+
return complete_if_cancelled_;
|
337
|
+
}
|
338
|
+
|
339
|
+
void complete_if_cancelled(bool b) noexcept
|
340
|
+
{
|
341
|
+
complete_if_cancelled_ = b;
|
342
|
+
}
|
343
|
+
|
344
|
+
private:
|
345
|
+
template <typename, typename, typename>
|
346
|
+
friend class co_composed_promise;
|
347
|
+
template <typename, typename, typename, typename>
|
348
|
+
friend class co_composed_state_return_overload;
|
349
|
+
|
350
|
+
void cancellation_on_suspend_fn(void (*fn)(void*))
|
351
|
+
{
|
352
|
+
cancellation_on_suspend_fn_ = fn;
|
353
|
+
}
|
354
|
+
|
355
|
+
void check_for_cancellation_on_transform()
|
356
|
+
{
|
357
|
+
if (throw_if_cancelled_ && !!cancelled())
|
358
|
+
throw_error(boost::asio::error::operation_aborted, "co_await");
|
359
|
+
}
|
360
|
+
|
361
|
+
bool check_for_cancellation_on_suspend(
|
362
|
+
co_composed_promise<Executors, Handler, Return>& promise) noexcept
|
363
|
+
{
|
364
|
+
if (complete_if_cancelled_ && !!cancelled() && cancellation_on_suspend_fn_)
|
365
|
+
{
|
366
|
+
promise.state().work_.reset();
|
367
|
+
promise.state().on_suspend_->fn_ = cancellation_on_suspend_fn_;
|
368
|
+
promise.state().on_suspend_->arg_ = &promise;
|
369
|
+
return false;
|
370
|
+
}
|
371
|
+
return true;
|
372
|
+
}
|
373
|
+
|
374
|
+
cancellation_state cancellation_state_;
|
375
|
+
void (*cancellation_on_suspend_fn_)(void*) =
|
376
|
+
co_composed_state_default_cancellation_on_suspend<
|
377
|
+
Executors, Handler, Return>::fn();
|
378
|
+
bool throw_if_cancelled_ = false;
|
379
|
+
bool complete_if_cancelled_ = true;
|
380
|
+
};
|
381
|
+
|
382
|
+
template <typename Executors, typename Handler, typename Return>
|
383
|
+
requires is_same<
|
384
|
+
typename associated_cancellation_slot<
|
385
|
+
Handler, cancellation_slot
|
386
|
+
>::asio_associated_cancellation_slot_is_unspecialised,
|
387
|
+
void>::value
|
388
|
+
class co_composed_state_cancellation<Executors, Handler, Return>
|
389
|
+
{
|
390
|
+
public:
|
391
|
+
void reset_cancellation_state()
|
392
|
+
{
|
393
|
+
}
|
394
|
+
|
395
|
+
template <typename Filter>
|
396
|
+
void reset_cancellation_state(Filter)
|
397
|
+
{
|
398
|
+
}
|
399
|
+
|
400
|
+
template <typename InFilter, typename OutFilter>
|
401
|
+
void reset_cancellation_state(InFilter&&, OutFilter&&)
|
402
|
+
{
|
403
|
+
}
|
404
|
+
|
405
|
+
cancellation_type_t cancelled() const noexcept
|
406
|
+
{
|
407
|
+
return cancellation_type::none;
|
408
|
+
}
|
409
|
+
|
410
|
+
void clear_cancellation_slot() noexcept
|
411
|
+
{
|
412
|
+
}
|
413
|
+
|
414
|
+
[[nodiscard]] bool throw_if_cancelled() const noexcept
|
415
|
+
{
|
416
|
+
return false;
|
417
|
+
}
|
418
|
+
|
419
|
+
void throw_if_cancelled(bool) noexcept
|
420
|
+
{
|
421
|
+
}
|
422
|
+
|
423
|
+
[[nodiscard]] bool complete_if_cancelled() const noexcept
|
424
|
+
{
|
425
|
+
return false;
|
426
|
+
}
|
427
|
+
|
428
|
+
void complete_if_cancelled(bool) noexcept
|
429
|
+
{
|
430
|
+
}
|
431
|
+
|
432
|
+
private:
|
433
|
+
template <typename, typename, typename>
|
434
|
+
friend class co_composed_promise;
|
435
|
+
template <typename, typename, typename, typename>
|
436
|
+
friend class co_composed_state_return_overload;
|
437
|
+
|
438
|
+
void cancellation_on_suspend_fn(void (*)(void*))
|
439
|
+
{
|
440
|
+
}
|
441
|
+
|
442
|
+
void check_for_cancellation_on_transform() noexcept
|
443
|
+
{
|
444
|
+
}
|
445
|
+
|
446
|
+
bool check_for_cancellation_on_suspend(
|
447
|
+
co_composed_promise<Executors, Handler, Return>&) noexcept
|
448
|
+
{
|
449
|
+
return true;
|
450
|
+
}
|
451
|
+
};
|
452
|
+
|
453
|
+
template <typename Executors, typename Handler, typename Return>
|
454
|
+
class co_composed_state
|
455
|
+
: public co_composed_state_return<Executors, Handler, Return>,
|
456
|
+
public co_composed_state_cancellation<Executors, Handler, Return>
|
457
|
+
{
|
458
|
+
public:
|
459
|
+
using io_executor_type = typename composed_work_guard<
|
460
|
+
typename composed_work<Executors>::head_type>::executor_type;
|
461
|
+
|
462
|
+
template <typename H>
|
463
|
+
co_composed_state(composed_io_executors<Executors>&& executors,
|
464
|
+
H&& h, co_composed_on_suspend& on_suspend)
|
465
|
+
: work_(std::move(executors)),
|
466
|
+
handler_(std::forward<H>(h)),
|
467
|
+
on_suspend_(&on_suspend)
|
468
|
+
{
|
469
|
+
this->reset_cancellation_state(enable_terminal_cancellation());
|
470
|
+
}
|
471
|
+
|
472
|
+
io_executor_type get_io_executor() const noexcept
|
473
|
+
{
|
474
|
+
return work_.head_.get_executor();
|
475
|
+
}
|
476
|
+
|
477
|
+
template <typename... Args>
|
478
|
+
[[nodiscard]] co_composed_completion<Args...> complete(Args&&... args)
|
479
|
+
requires requires { declval<Handler>()(std::forward<Args>(args)...); }
|
480
|
+
{
|
481
|
+
return co_composed_completion<Args...>(std::forward<Args>(args)...);
|
482
|
+
}
|
483
|
+
|
484
|
+
const Handler& handler() const noexcept
|
485
|
+
{
|
486
|
+
return handler_;
|
487
|
+
}
|
488
|
+
|
489
|
+
private:
|
490
|
+
template <typename, typename, typename>
|
491
|
+
friend class co_composed_handler_base;
|
492
|
+
template <typename, typename, typename>
|
493
|
+
friend class co_composed_promise;
|
494
|
+
template <typename, typename, typename, typename>
|
495
|
+
friend class co_composed_promise_return_overload;
|
496
|
+
template <typename, typename, typename>
|
497
|
+
friend class co_composed_state_cancellation;
|
498
|
+
template <typename, typename, typename, typename>
|
499
|
+
friend class co_composed_state_return_overload;
|
500
|
+
template <typename, typename, typename, typename...>
|
501
|
+
friend struct co_composed_state_default_cancellation_on_suspend_impl;
|
502
|
+
|
503
|
+
composed_work<Executors> work_;
|
504
|
+
Handler handler_;
|
505
|
+
co_composed_on_suspend* on_suspend_;
|
506
|
+
};
|
507
|
+
|
508
|
+
template <typename Executors, typename Handler, typename Return>
|
509
|
+
class co_composed_handler_cancellation
|
510
|
+
{
|
511
|
+
public:
|
512
|
+
using cancellation_slot_type = cancellation_slot;
|
513
|
+
|
514
|
+
cancellation_slot_type get_cancellation_slot() const noexcept
|
515
|
+
{
|
516
|
+
return static_cast<
|
517
|
+
const co_composed_handler_base<Executors, Handler, Return>*>(
|
518
|
+
this)->promise().state().get_cancellation_slot();
|
519
|
+
}
|
520
|
+
};
|
521
|
+
|
522
|
+
template <typename Executors, typename Handler, typename Return>
|
523
|
+
requires is_same<
|
524
|
+
typename associated_cancellation_slot<
|
525
|
+
Handler, cancellation_slot
|
526
|
+
>::asio_associated_cancellation_slot_is_unspecialised,
|
527
|
+
void>::value
|
528
|
+
class co_composed_handler_cancellation<Executors, Handler, Return>
|
529
|
+
{
|
530
|
+
};
|
531
|
+
|
532
|
+
template <typename Executors, typename Handler, typename Return>
|
533
|
+
class co_composed_handler_base :
|
534
|
+
public co_composed_handler_cancellation<Executors, Handler, Return>
|
535
|
+
{
|
536
|
+
public:
|
537
|
+
co_composed_handler_base(
|
538
|
+
co_composed_promise<Executors, Handler, Return>& p) noexcept
|
539
|
+
: p_(&p)
|
540
|
+
{
|
541
|
+
}
|
542
|
+
|
543
|
+
co_composed_handler_base(co_composed_handler_base&& other) noexcept
|
544
|
+
: p_(std::exchange(other.p_, nullptr))
|
545
|
+
{
|
546
|
+
}
|
547
|
+
|
548
|
+
~co_composed_handler_base()
|
549
|
+
{
|
550
|
+
if (p_) [[unlikely]]
|
551
|
+
p_->destroy();
|
552
|
+
}
|
553
|
+
|
554
|
+
co_composed_promise<Executors, Handler, Return>& promise() const noexcept
|
555
|
+
{
|
556
|
+
return *p_;
|
557
|
+
}
|
558
|
+
|
559
|
+
protected:
|
560
|
+
void resume(void* result)
|
561
|
+
{
|
562
|
+
co_composed_on_suspend on_suspend{};
|
563
|
+
std::exchange(p_, nullptr)->resume(p_, result, on_suspend);
|
564
|
+
if (on_suspend.fn_)
|
565
|
+
on_suspend.fn_(on_suspend.arg_);
|
566
|
+
}
|
567
|
+
|
568
|
+
private:
|
569
|
+
co_composed_promise<Executors, Handler, Return>* p_;
|
570
|
+
};
|
571
|
+
|
572
|
+
template <typename Executors, typename Handler,
|
573
|
+
typename Return, typename Signature>
|
574
|
+
class co_composed_handler;
|
575
|
+
|
576
|
+
template <typename Executors, typename Handler,
|
577
|
+
typename Return, typename R, typename... Args>
|
578
|
+
class co_composed_handler<Executors, Handler, Return, R(Args...)>
|
579
|
+
: public co_composed_handler_base<Executors, Handler, Return>
|
580
|
+
{
|
581
|
+
public:
|
582
|
+
using co_composed_handler_base<Executors,
|
583
|
+
Handler, Return>::co_composed_handler_base;
|
584
|
+
|
585
|
+
using result_type = std::tuple<typename decay<Args>::type...>;
|
586
|
+
|
587
|
+
template <typename... T>
|
588
|
+
void operator()(T&&... args)
|
589
|
+
{
|
590
|
+
result_type result(std::forward<T>(args)...);
|
591
|
+
this->resume(&result);
|
592
|
+
}
|
593
|
+
|
594
|
+
static auto on_resume(void* result)
|
595
|
+
{
|
596
|
+
auto& args = *static_cast<result_type*>(result);
|
597
|
+
if constexpr (sizeof...(Args) == 0)
|
598
|
+
return;
|
599
|
+
else if constexpr (sizeof...(Args) == 1)
|
600
|
+
return std::move(std::get<0>(args));
|
601
|
+
else
|
602
|
+
return std::move(args);
|
603
|
+
}
|
604
|
+
};
|
605
|
+
|
606
|
+
template <typename Executors, typename Handler,
|
607
|
+
typename Return, typename R, typename... Args>
|
608
|
+
class co_composed_handler<Executors, Handler,
|
609
|
+
Return, R(boost::system::error_code, Args...)>
|
610
|
+
: public co_composed_handler_base<Executors, Handler, Return>
|
611
|
+
{
|
612
|
+
public:
|
613
|
+
using co_composed_handler_base<Executors,
|
614
|
+
Handler, Return>::co_composed_handler_base;
|
615
|
+
|
616
|
+
using args_type = std::tuple<typename decay<Args>::type...>;
|
617
|
+
using result_type = std::tuple<boost::system::error_code, args_type>;
|
618
|
+
|
619
|
+
template <typename... T>
|
620
|
+
void operator()(const boost::system::error_code& ec, T&&... args)
|
621
|
+
{
|
622
|
+
result_type result(ec, args_type(std::forward<T>(args)...));
|
623
|
+
this->resume(&result);
|
624
|
+
}
|
625
|
+
|
626
|
+
static auto on_resume(void* result)
|
627
|
+
{
|
628
|
+
auto& [ec, args] = *static_cast<result_type*>(result);
|
629
|
+
throw_error(ec);
|
630
|
+
if constexpr (sizeof...(Args) == 0)
|
631
|
+
return;
|
632
|
+
else if constexpr (sizeof...(Args) == 1)
|
633
|
+
return std::move(std::get<0>(args));
|
634
|
+
else
|
635
|
+
return std::move(args);
|
636
|
+
}
|
637
|
+
};
|
638
|
+
|
639
|
+
template <typename Executors, typename Handler,
|
640
|
+
typename Return, typename R, typename... Args>
|
641
|
+
class co_composed_handler<Executors, Handler,
|
642
|
+
Return, R(std::exception_ptr, Args...)>
|
643
|
+
: public co_composed_handler_base<Executors, Handler, Return>
|
644
|
+
{
|
645
|
+
public:
|
646
|
+
using co_composed_handler_base<Executors,
|
647
|
+
Handler, Return>::co_composed_handler_base;
|
648
|
+
|
649
|
+
using args_type = std::tuple<typename decay<Args>::type...>;
|
650
|
+
using result_type = std::tuple<std::exception_ptr, args_type>;
|
651
|
+
|
652
|
+
template <typename... T>
|
653
|
+
void operator()(std::exception_ptr ex, T&&... args)
|
654
|
+
{
|
655
|
+
result_type result(std::move(ex), args_type(std::forward<T>(args)...));
|
656
|
+
this->resume(&result);
|
657
|
+
}
|
658
|
+
|
659
|
+
static auto on_resume(void* result)
|
660
|
+
{
|
661
|
+
auto& [ex, args] = *static_cast<result_type*>(result);
|
662
|
+
if (ex)
|
663
|
+
std::rethrow_exception(ex);
|
664
|
+
if constexpr (sizeof...(Args) == 0)
|
665
|
+
return;
|
666
|
+
else if constexpr (sizeof...(Args) == 1)
|
667
|
+
return std::move(std::get<0>(args));
|
668
|
+
else
|
669
|
+
return std::move(args);
|
670
|
+
}
|
671
|
+
};
|
672
|
+
|
673
|
+
template <typename Executors, typename Handler, typename Return>
|
674
|
+
class co_composed_promise_return;
|
675
|
+
|
676
|
+
template <typename Executors, typename Handler>
|
677
|
+
class co_composed_promise_return<Executors, Handler, co_composed_returns<>>
|
678
|
+
{
|
679
|
+
public:
|
680
|
+
auto final_suspend() noexcept
|
681
|
+
{
|
682
|
+
return suspend_never();
|
683
|
+
}
|
684
|
+
|
685
|
+
void return_void() noexcept
|
686
|
+
{
|
687
|
+
}
|
688
|
+
};
|
689
|
+
|
690
|
+
template <typename Executors, typename Handler,
|
691
|
+
typename Return, typename Signature>
|
692
|
+
class co_composed_promise_return_overload;
|
693
|
+
|
694
|
+
template <typename Executors, typename Handler,
|
695
|
+
typename Return, typename R, typename... Args>
|
696
|
+
class co_composed_promise_return_overload<
|
697
|
+
Executors, Handler, Return, R(Args...)>
|
698
|
+
{
|
699
|
+
public:
|
700
|
+
using derived_type = co_composed_promise<Executors, Handler, Return>;
|
701
|
+
using return_type = std::tuple<Args...>;
|
702
|
+
|
703
|
+
void return_value(std::tuple<Args...>&& value)
|
704
|
+
{
|
705
|
+
derived_type& promise = *static_cast<derived_type*>(this);
|
706
|
+
promise.state().return_value_ = std::move(value);
|
707
|
+
promise.state().work_.reset();
|
708
|
+
promise.state().on_suspend_->arg_ = this;
|
709
|
+
promise.state().on_suspend_->fn_ =
|
710
|
+
[](void* p)
|
711
|
+
{
|
712
|
+
auto& promise = *static_cast<derived_type*>(p);
|
713
|
+
|
714
|
+
co_composed_handler_base<Executors, Handler,
|
715
|
+
Return> composed_handler(promise);
|
716
|
+
|
717
|
+
Handler handler(std::move(promise.state().handler_));
|
718
|
+
return_type result(
|
719
|
+
std::move(std::get<return_type>(promise.state().return_value_)));
|
720
|
+
|
721
|
+
co_composed_handler_base<Executors, Handler,
|
722
|
+
Return>(std::move(composed_handler));
|
723
|
+
|
724
|
+
std::apply(std::move(handler), std::move(result));
|
725
|
+
};
|
726
|
+
}
|
727
|
+
};
|
728
|
+
|
729
|
+
template <typename Executors, typename Handler, typename... Signatures>
|
730
|
+
class co_composed_promise_return<Executors,
|
731
|
+
Handler, co_composed_returns<Signatures...>>
|
732
|
+
: public co_composed_promise_return_overload<Executors,
|
733
|
+
Handler, co_composed_returns<Signatures...>, Signatures>...
|
734
|
+
{
|
735
|
+
public:
|
736
|
+
auto final_suspend() noexcept
|
737
|
+
{
|
738
|
+
return suspend_always();
|
739
|
+
}
|
740
|
+
|
741
|
+
using co_composed_promise_return_overload<Executors, Handler,
|
742
|
+
co_composed_returns<Signatures...>, Signatures>::return_value...;
|
743
|
+
|
744
|
+
private:
|
745
|
+
template <typename, typename, typename, typename>
|
746
|
+
friend class co_composed_promise_return_overload;
|
747
|
+
};
|
748
|
+
|
749
|
+
template <typename Executors, typename Handler, typename Return>
|
750
|
+
class co_composed_promise
|
751
|
+
: public co_composed_promise_return<Executors, Handler, Return>
|
752
|
+
{
|
753
|
+
public:
|
754
|
+
template <typename... Args>
|
755
|
+
void* operator new(std::size_t size,
|
756
|
+
co_composed_state<Executors, Handler, Return>& state, Args&&...)
|
757
|
+
{
|
758
|
+
block_allocator_type allocator(
|
759
|
+
(get_associated_allocator)(state.handler_,
|
760
|
+
recycling_allocator<void>()));
|
761
|
+
|
762
|
+
block* base_ptr = std::allocator_traits<block_allocator_type>::allocate(
|
763
|
+
allocator, blocks(sizeof(allocator_type)) + blocks(size));
|
764
|
+
|
765
|
+
new (static_cast<void*>(base_ptr)) allocator_type(std::move(allocator));
|
766
|
+
|
767
|
+
return base_ptr + blocks(sizeof(allocator_type));
|
768
|
+
}
|
769
|
+
|
770
|
+
template <typename C, typename... Args>
|
771
|
+
void* operator new(std::size_t size, C&&,
|
772
|
+
co_composed_state<Executors, Handler, Return>& state, Args&&...)
|
773
|
+
{
|
774
|
+
return co_composed_promise::operator new(size, state);
|
775
|
+
}
|
776
|
+
|
777
|
+
void operator delete(void* ptr, std::size_t size)
|
778
|
+
{
|
779
|
+
block* base_ptr = static_cast<block*>(ptr) - blocks(sizeof(allocator_type));
|
780
|
+
|
781
|
+
allocator_type* allocator_ptr = std::launder(
|
782
|
+
static_cast<allocator_type*>(static_cast<void*>(base_ptr)));
|
783
|
+
|
784
|
+
block_allocator_type block_allocator(std::move(*allocator_ptr));
|
785
|
+
allocator_ptr->~allocator_type();
|
786
|
+
|
787
|
+
std::allocator_traits<block_allocator_type>::deallocate(block_allocator,
|
788
|
+
base_ptr, blocks(sizeof(allocator_type)) + blocks(size));
|
789
|
+
}
|
790
|
+
|
791
|
+
template <typename... Args>
|
792
|
+
co_composed_promise(
|
793
|
+
co_composed_state<Executors, Handler, Return>& state, Args&&...)
|
794
|
+
: state_(state)
|
795
|
+
{
|
796
|
+
}
|
797
|
+
|
798
|
+
template <typename C, typename... Args>
|
799
|
+
co_composed_promise(C&&,
|
800
|
+
co_composed_state<Executors, Handler, Return>& state, Args&&...)
|
801
|
+
: state_(state)
|
802
|
+
{
|
803
|
+
}
|
804
|
+
|
805
|
+
void destroy() noexcept
|
806
|
+
{
|
807
|
+
coroutine_handle<co_composed_promise>::from_promise(*this).destroy();
|
808
|
+
}
|
809
|
+
|
810
|
+
void resume(co_composed_promise*& owner, void* result,
|
811
|
+
co_composed_on_suspend& on_suspend)
|
812
|
+
{
|
813
|
+
state_.on_suspend_ = &on_suspend;
|
814
|
+
state_.clear_cancellation_slot();
|
815
|
+
owner_ = &owner;
|
816
|
+
result_ = result;
|
817
|
+
coroutine_handle<co_composed_promise>::from_promise(*this).resume();
|
818
|
+
}
|
819
|
+
|
820
|
+
co_composed_state<Executors, Handler, Return>& state() noexcept
|
821
|
+
{
|
822
|
+
return state_;
|
823
|
+
}
|
824
|
+
|
825
|
+
void get_return_object() noexcept
|
826
|
+
{
|
827
|
+
}
|
828
|
+
|
829
|
+
auto initial_suspend() noexcept
|
830
|
+
{
|
831
|
+
return suspend_never();
|
832
|
+
}
|
833
|
+
|
834
|
+
void unhandled_exception()
|
835
|
+
{
|
836
|
+
if (owner_)
|
837
|
+
*owner_ = this;
|
838
|
+
throw;
|
839
|
+
}
|
840
|
+
|
841
|
+
template <async_operation Op>
|
842
|
+
auto await_transform(Op&& op)
|
843
|
+
{
|
844
|
+
class [[nodiscard]] awaitable
|
845
|
+
{
|
846
|
+
public:
|
847
|
+
awaitable(Op&& op, co_composed_promise& promise)
|
848
|
+
: op_(std::forward<Op>(op)),
|
849
|
+
promise_(promise)
|
850
|
+
{
|
851
|
+
}
|
852
|
+
|
853
|
+
constexpr bool await_ready() const noexcept
|
854
|
+
{
|
855
|
+
return false;
|
856
|
+
}
|
857
|
+
|
858
|
+
void await_suspend(coroutine_handle<co_composed_promise>)
|
859
|
+
{
|
860
|
+
if (promise_.state_.check_for_cancellation_on_suspend(promise_))
|
861
|
+
{
|
862
|
+
promise_.state_.on_suspend_->arg_ = this;
|
863
|
+
promise_.state_.on_suspend_->fn_ =
|
864
|
+
[](void* p)
|
865
|
+
{
|
866
|
+
std::forward<Op>(static_cast<awaitable*>(p)->op_)(
|
867
|
+
co_composed_handler<Executors, Handler,
|
868
|
+
Return, completion_signature_of_t<Op>>(
|
869
|
+
static_cast<awaitable*>(p)->promise_));
|
870
|
+
};
|
871
|
+
}
|
872
|
+
}
|
873
|
+
|
874
|
+
auto await_resume()
|
875
|
+
{
|
876
|
+
return co_composed_handler<Executors, Handler, Return,
|
877
|
+
completion_signature_of_t<Op>>::on_resume(promise_.result_);
|
878
|
+
}
|
879
|
+
|
880
|
+
private:
|
881
|
+
Op&& op_;
|
882
|
+
co_composed_promise& promise_;
|
883
|
+
};
|
884
|
+
|
885
|
+
state_.check_for_cancellation_on_transform();
|
886
|
+
return awaitable{std::forward<Op>(op), *this};
|
887
|
+
}
|
888
|
+
|
889
|
+
template <typename... Args>
|
890
|
+
auto yield_value(co_composed_completion<Args...>&& result)
|
891
|
+
{
|
892
|
+
class [[nodiscard]] awaitable
|
893
|
+
{
|
894
|
+
public:
|
895
|
+
awaitable(co_composed_completion<Args...>&& result,
|
896
|
+
co_composed_promise& promise)
|
897
|
+
: result_(std::move(result)),
|
898
|
+
promise_(promise)
|
899
|
+
{
|
900
|
+
}
|
901
|
+
|
902
|
+
constexpr bool await_ready() const noexcept
|
903
|
+
{
|
904
|
+
return false;
|
905
|
+
}
|
906
|
+
|
907
|
+
void await_suspend(coroutine_handle<co_composed_promise>)
|
908
|
+
{
|
909
|
+
promise_.state_.work_.reset();
|
910
|
+
promise_.state_.on_suspend_->arg_ = this;
|
911
|
+
promise_.state_.on_suspend_->fn_ =
|
912
|
+
[](void* p)
|
913
|
+
{
|
914
|
+
awaitable& a = *static_cast<awaitable*>(p);
|
915
|
+
|
916
|
+
co_composed_handler_base<Executors, Handler,
|
917
|
+
Return> composed_handler(a.promise_);
|
918
|
+
|
919
|
+
Handler handler(std::move(a.promise_.state_.handler_));
|
920
|
+
std::tuple<typename decay<Args>::type...> result(
|
921
|
+
std::move(static_cast<std::tuple<Args&&...>>(a.result_)));
|
922
|
+
|
923
|
+
co_composed_handler_base<Executors, Handler,
|
924
|
+
Return>(std::move(composed_handler));
|
925
|
+
|
926
|
+
std::apply(std::move(handler), std::move(result));
|
927
|
+
};
|
928
|
+
}
|
929
|
+
|
930
|
+
void await_resume() noexcept
|
931
|
+
{
|
932
|
+
}
|
933
|
+
|
934
|
+
private:
|
935
|
+
co_composed_completion<Args...> result_;
|
936
|
+
co_composed_promise& promise_;
|
937
|
+
};
|
938
|
+
|
939
|
+
return awaitable{std::move(result), *this};
|
940
|
+
}
|
941
|
+
|
942
|
+
private:
|
943
|
+
using allocator_type =
|
944
|
+
associated_allocator_t<Handler, recycling_allocator<void>>;
|
945
|
+
|
946
|
+
union block
|
947
|
+
{
|
948
|
+
std::max_align_t max_align;
|
949
|
+
alignas(allocator_type) char pad[alignof(allocator_type)];
|
950
|
+
};
|
951
|
+
|
952
|
+
using block_allocator_type =
|
953
|
+
typename std::allocator_traits<allocator_type>
|
954
|
+
::template rebind_alloc<block>;
|
955
|
+
|
956
|
+
static constexpr std::size_t blocks(std::size_t size)
|
957
|
+
{
|
958
|
+
return (size + sizeof(block) - 1) / sizeof(block);
|
959
|
+
}
|
960
|
+
|
961
|
+
co_composed_state<Executors, Handler, Return>& state_;
|
962
|
+
co_composed_promise** owner_ = nullptr;
|
963
|
+
void* result_ = nullptr;
|
964
|
+
};
|
965
|
+
|
966
|
+
template <typename Implementation, typename Executors, typename... Signatures>
|
967
|
+
class initiate_co_composed
|
968
|
+
{
|
969
|
+
public:
|
970
|
+
using executor_type = typename composed_io_executors<Executors>::head_type;
|
971
|
+
|
972
|
+
template <typename I>
|
973
|
+
initiate_co_composed(I&& impl, composed_io_executors<Executors>&& executors)
|
974
|
+
: implementation_(std::forward<I>(impl)),
|
975
|
+
executors_(std::move(executors))
|
976
|
+
{
|
977
|
+
}
|
978
|
+
|
979
|
+
executor_type get_executor() const noexcept
|
980
|
+
{
|
981
|
+
return executors_.head_;
|
982
|
+
}
|
983
|
+
|
984
|
+
template <typename Handler, typename... InitArgs>
|
985
|
+
void operator()(Handler&& handler, InitArgs&&... init_args) const &
|
986
|
+
{
|
987
|
+
using handler_type = typename decay<Handler>::type;
|
988
|
+
using returns_type = co_composed_returns<Signatures...>;
|
989
|
+
co_composed_on_suspend on_suspend{};
|
990
|
+
implementation_(
|
991
|
+
co_composed_state<Executors, handler_type, returns_type>(
|
992
|
+
executors_, std::forward<Handler>(handler), on_suspend),
|
993
|
+
std::forward<InitArgs>(init_args)...);
|
994
|
+
if (on_suspend.fn_)
|
995
|
+
on_suspend.fn_(on_suspend.arg_);
|
996
|
+
}
|
997
|
+
|
998
|
+
template <typename Handler, typename... InitArgs>
|
999
|
+
void operator()(Handler&& handler, InitArgs&&... init_args) &&
|
1000
|
+
{
|
1001
|
+
using handler_type = typename decay<Handler>::type;
|
1002
|
+
using returns_type = co_composed_returns<Signatures...>;
|
1003
|
+
co_composed_on_suspend on_suspend{};
|
1004
|
+
std::move(implementation_)(
|
1005
|
+
co_composed_state<Executors, handler_type, returns_type>(
|
1006
|
+
std::move(executors_), std::forward<Handler>(handler), on_suspend),
|
1007
|
+
std::forward<InitArgs>(init_args)...);
|
1008
|
+
if (on_suspend.fn_)
|
1009
|
+
on_suspend.fn_(on_suspend.arg_);
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
private:
|
1013
|
+
Implementation implementation_;
|
1014
|
+
composed_io_executors<Executors> executors_;
|
1015
|
+
};
|
1016
|
+
|
1017
|
+
template <typename... Signatures, typename Implementation, typename Executors>
|
1018
|
+
inline initiate_co_composed<Implementation, Executors, Signatures...>
|
1019
|
+
make_initiate_co_composed(Implementation&& implementation,
|
1020
|
+
composed_io_executors<Executors>&& executors)
|
1021
|
+
{
|
1022
|
+
return initiate_co_composed<
|
1023
|
+
typename decay<Implementation>::type, Executors, Signatures...>(
|
1024
|
+
std::forward<Implementation>(implementation), std::move(executors));
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
} // namespace detail
|
1028
|
+
|
1029
|
+
template <completion_signature... Signatures,
|
1030
|
+
typename Implementation, typename... IoObjectsOrExecutors>
|
1031
|
+
inline auto co_composed(Implementation&& implementation,
|
1032
|
+
IoObjectsOrExecutors&&... io_objects_or_executors)
|
1033
|
+
{
|
1034
|
+
return detail::make_initiate_co_composed<Signatures...>(
|
1035
|
+
std::forward<Implementation>(implementation),
|
1036
|
+
detail::make_composed_io_executors(
|
1037
|
+
detail::get_composed_io_executor(
|
1038
|
+
std::forward<IoObjectsOrExecutors>(
|
1039
|
+
io_objects_or_executors))...));
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
} // namespace experimental
|
1043
|
+
|
1044
|
+
#if !defined(GENERATING_DOCUMENTATION)
|
1045
|
+
|
1046
|
+
template <template <typename, typename> class Associator,
|
1047
|
+
typename Executors, typename Handler, typename Return,
|
1048
|
+
typename Signature, typename DefaultCandidate>
|
1049
|
+
struct associator<Associator,
|
1050
|
+
experimental::detail::co_composed_handler<
|
1051
|
+
Executors, Handler, Return, Signature>,
|
1052
|
+
DefaultCandidate>
|
1053
|
+
: Associator<Handler, DefaultCandidate>
|
1054
|
+
{
|
1055
|
+
static typename Associator<Handler, DefaultCandidate>::type
|
1056
|
+
get(const experimental::detail::co_composed_handler<
|
1057
|
+
Executors, Handler, Return, Signature>& h) BOOST_ASIO_NOEXCEPT
|
1058
|
+
{
|
1059
|
+
return Associator<Handler, DefaultCandidate>::get(
|
1060
|
+
h.promise().state().handler());
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
|
1064
|
+
typename Associator<Handler, DefaultCandidate>::type)
|
1065
|
+
get(const experimental::detail::co_composed_handler<
|
1066
|
+
Executors, Handler, Return, Signature>& h,
|
1067
|
+
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
|
1068
|
+
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
|
1069
|
+
Associator<Handler, DefaultCandidate>::get(
|
1070
|
+
h.promise().state().handler(), c)))
|
1071
|
+
{
|
1072
|
+
return Associator<Handler, DefaultCandidate>::get(
|
1073
|
+
h.promise().state().handler(), c);
|
1074
|
+
}
|
1075
|
+
};
|
1076
|
+
|
1077
|
+
#endif // !defined(GENERATING_DOCUMENTATION)
|
1078
|
+
|
1079
|
+
} // namespace asio
|
1080
|
+
} // namespace boost
|
1081
|
+
|
1082
|
+
#if !defined(GENERATING_DOCUMENTATION)
|
1083
|
+
# if defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
1084
|
+
namespace std {
|
1085
|
+
# else // defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
1086
|
+
namespace std { namespace experimental {
|
1087
|
+
# endif // defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
1088
|
+
|
1089
|
+
template <typename C, typename Executors,
|
1090
|
+
typename Handler, typename Return, typename... Args>
|
1091
|
+
struct coroutine_traits<void, C&,
|
1092
|
+
boost::asio::experimental::detail::co_composed_state<
|
1093
|
+
Executors, Handler, Return>,
|
1094
|
+
Args...>
|
1095
|
+
{
|
1096
|
+
using promise_type =
|
1097
|
+
boost::asio::experimental::detail::co_composed_promise<
|
1098
|
+
Executors, Handler, Return>;
|
1099
|
+
};
|
1100
|
+
|
1101
|
+
template <typename C, typename Executors,
|
1102
|
+
typename Handler, typename Return, typename... Args>
|
1103
|
+
struct coroutine_traits<void, C&&,
|
1104
|
+
boost::asio::experimental::detail::co_composed_state<
|
1105
|
+
Executors, Handler, Return>,
|
1106
|
+
Args...>
|
1107
|
+
{
|
1108
|
+
using promise_type =
|
1109
|
+
boost::asio::experimental::detail::co_composed_promise<
|
1110
|
+
Executors, Handler, Return>;
|
1111
|
+
};
|
1112
|
+
|
1113
|
+
template <typename Executors, typename Handler,
|
1114
|
+
typename Return, typename... Args>
|
1115
|
+
struct coroutine_traits<void,
|
1116
|
+
boost::asio::experimental::detail::co_composed_state<
|
1117
|
+
Executors, Handler, Return>,
|
1118
|
+
Args...>
|
1119
|
+
{
|
1120
|
+
using promise_type =
|
1121
|
+
boost::asio::experimental::detail::co_composed_promise<
|
1122
|
+
Executors, Handler, Return>;
|
1123
|
+
};
|
1124
|
+
|
1125
|
+
# if defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
1126
|
+
} // namespace std
|
1127
|
+
# else // defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
1128
|
+
}} // namespace std::experimental
|
1129
|
+
# endif // defined(BOOST_ASIO_HAS_STD_COROUTINE)
|
1130
|
+
#endif // !defined(GENERATING_DOCUMENTATION)
|
1131
|
+
|
1132
|
+
#include <boost/asio/detail/pop_options.hpp>
|
1133
|
+
|
1134
|
+
#endif // BOOST_ASIO_IMPL_EXPERIMENTAL_CO_COMPOSED_HPP
|