diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-11-06 11:03:00 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-11-06 11:18:38 +0300 |
commit | 658682dbe663353ecdf6cb50a846c54b3dd24481 (patch) | |
tree | 231c2899c3cd1b8790161306fd1f235d744e4215 | |
parent | 8cf98f8169af124576399a29eac2bc2a691124e3 (diff) | |
download | ydb-658682dbe663353ecdf6cb50a846c54b3dd24481.tar.gz |
Update contrib/restricted/boost/asio to 1.81.0
commit_hash:831bd28098493bc44ccb221464203e928703d3f4
134 files changed, 7330 insertions, 2422 deletions
diff --git a/contrib/restricted/boost/asio/.yandex_meta/devtools.copyrights.report b/contrib/restricted/boost/asio/.yandex_meta/devtools.copyrights.report index b1bc68828b..b7c7e48a28 100644 --- a/contrib/restricted/boost/asio/.yandex_meta/devtools.copyrights.report +++ b/contrib/restricted/boost/asio/.yandex_meta/devtools.copyrights.report @@ -81,6 +81,8 @@ BELONGS ya.make Match type : COPYRIGHT Files with this license: include/boost/asio.hpp [5:5] + include/boost/asio/any_completion_executor.hpp [5:5] + include/boost/asio/any_completion_handler.hpp [5:5] include/boost/asio/any_io_executor.hpp [5:5] include/boost/asio/append.hpp [5:5] include/boost/asio/as_tuple.hpp [5:5] @@ -130,6 +132,7 @@ BELONGS ya.make include/boost/asio/compose.hpp [5:5] include/boost/asio/connect.hpp [5:5] include/boost/asio/connect_pipe.hpp [5:5] + include/boost/asio/consign.hpp [5:5] include/boost/asio/coroutine.hpp [5:5] include/boost/asio/deadline_timer.hpp [5:5] include/boost/asio/defer.hpp [5:5] @@ -151,6 +154,7 @@ BELONGS ya.make include/boost/asio/detail/chrono.hpp [5:5] include/boost/asio/detail/chrono_time_traits.hpp [5:5] include/boost/asio/detail/completion_handler.hpp [5:5] + include/boost/asio/detail/composed_work.hpp [5:5] include/boost/asio/detail/concurrency_hint.hpp [5:5] include/boost/asio/detail/conditionally_enabled_event.hpp [5:5] include/boost/asio/detail/conditionally_enabled_mutex.hpp [5:5] @@ -470,6 +474,7 @@ BELONGS ya.make include/boost/asio/experimental/channel.hpp [5:5] include/boost/asio/experimental/channel_error.hpp [5:5] include/boost/asio/experimental/channel_traits.hpp [5:5] + include/boost/asio/experimental/co_composed.hpp [5:5] include/boost/asio/experimental/concurrent_channel.hpp [5:5] include/boost/asio/experimental/deferred.hpp [5:5] include/boost/asio/experimental/detail/channel_handler.hpp [5:5] @@ -484,6 +489,7 @@ BELONGS ya.make include/boost/asio/experimental/detail/impl/channel_service.hpp [5:5] include/boost/asio/experimental/impl/as_single.hpp [5:5] include/boost/asio/experimental/impl/channel_error.ipp [5:5] + include/boost/asio/experimental/impl/co_composed.hpp [5:5] include/boost/asio/experimental/impl/parallel_group.hpp [5:5] include/boost/asio/experimental/parallel_group.hpp [5:5] include/boost/asio/experimental/prepend.hpp [5:5] @@ -499,6 +505,7 @@ BELONGS ya.make include/boost/asio/handler_continuation_hook.hpp [5:5] include/boost/asio/handler_invoke_hook.hpp [5:5] include/boost/asio/high_resolution_timer.hpp [5:5] + include/boost/asio/impl/any_completion_executor.ipp [5:5] include/boost/asio/impl/any_io_executor.ipp [5:5] include/boost/asio/impl/append.hpp [5:5] include/boost/asio/impl/as_tuple.hpp [5:5] @@ -507,10 +514,10 @@ BELONGS ya.make include/boost/asio/impl/buffered_write_stream.hpp [5:5] include/boost/asio/impl/cancellation_signal.ipp [5:5] include/boost/asio/impl/co_spawn.hpp [5:5] - include/boost/asio/impl/compose.hpp [5:5] include/boost/asio/impl/connect.hpp [5:5] include/boost/asio/impl/connect_pipe.hpp [5:5] include/boost/asio/impl/connect_pipe.ipp [5:7] + include/boost/asio/impl/consign.hpp [5:5] include/boost/asio/impl/defer.hpp [5:5] include/boost/asio/impl/deferred.hpp [5:5] include/boost/asio/impl/detached.hpp [5:5] @@ -787,6 +794,18 @@ BELONGS ya.make include/boost/asio/ssl/impl/context.hpp [5:6] include/boost/asio/ssl/impl/context.ipp [5:6] +KEEP COPYRIGHT_SERVICE_LABEL ac8aa760fecd6ff857e31432dcb50229 +BELONGS ya.make + License text: + // Copyright (c) 2022 Klemens D. Morgenstern + // (klemens dot morgenstern at gmx dot net) + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + include/boost/asio/experimental/use_promise.hpp [5:6] + KEEP COPYRIGHT_SERVICE_LABEL b54a4b9bb1b7b86932babc13c91439ba BELONGS ya.make License text: @@ -800,12 +819,13 @@ BELONGS ya.make include/boost/asio/experimental/co_spawn.hpp [5:6] include/boost/asio/experimental/coro.hpp [5:6] include/boost/asio/experimental/coro_traits.hpp [5:6] - include/boost/asio/experimental/detail/completion_handler_erasure.hpp [5:6] + include/boost/asio/experimental/detail/coro_completion_handler.hpp [5:6] include/boost/asio/experimental/detail/coro_promise_allocator.hpp [5:6] include/boost/asio/experimental/detail/partial_promise.hpp [5:6] include/boost/asio/experimental/impl/coro.hpp [5:6] include/boost/asio/experimental/impl/promise.hpp [5:6] include/boost/asio/experimental/impl/use_coro.hpp [5:6] + include/boost/asio/experimental/impl/use_promise.hpp [5:6] include/boost/asio/experimental/promise.hpp [5:6] include/boost/asio/experimental/use_coro.hpp [5:6] diff --git a/contrib/restricted/boost/asio/.yandex_meta/devtools.licenses.report b/contrib/restricted/boost/asio/.yandex_meta/devtools.licenses.report index ef36afa22c..b1ce2a74ae 100644 --- a/contrib/restricted/boost/asio/.yandex_meta/devtools.licenses.report +++ b/contrib/restricted/boost/asio/.yandex_meta/devtools.licenses.report @@ -45,6 +45,8 @@ BELONGS ya.make Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0 Files with this license: include/boost/asio.hpp [7:8] + include/boost/asio/any_completion_executor.hpp [7:8] + include/boost/asio/any_completion_handler.hpp [7:8] include/boost/asio/any_io_executor.hpp [7:8] include/boost/asio/append.hpp [7:8] include/boost/asio/as_tuple.hpp [7:8] @@ -94,6 +96,7 @@ BELONGS ya.make include/boost/asio/compose.hpp [7:8] include/boost/asio/connect.hpp [7:8] include/boost/asio/connect_pipe.hpp [7:8] + include/boost/asio/consign.hpp [7:8] include/boost/asio/coroutine.hpp [7:8] include/boost/asio/deadline_timer.hpp [7:8] include/boost/asio/defer.hpp [7:8] @@ -115,6 +118,7 @@ BELONGS ya.make include/boost/asio/detail/chrono.hpp [7:8] include/boost/asio/detail/chrono_time_traits.hpp [7:8] include/boost/asio/detail/completion_handler.hpp [7:8] + include/boost/asio/detail/composed_work.hpp [7:8] include/boost/asio/detail/concurrency_hint.hpp [7:8] include/boost/asio/detail/conditionally_enabled_event.hpp [7:8] include/boost/asio/detail/conditionally_enabled_mutex.hpp [7:8] @@ -435,6 +439,7 @@ BELONGS ya.make include/boost/asio/experimental/channel.hpp [7:8] include/boost/asio/experimental/channel_error.hpp [7:8] include/boost/asio/experimental/channel_traits.hpp [7:8] + include/boost/asio/experimental/co_composed.hpp [7:8] include/boost/asio/experimental/co_spawn.hpp [8:9] include/boost/asio/experimental/concurrent_channel.hpp [7:8] include/boost/asio/experimental/coro.hpp [8:9] @@ -448,21 +453,24 @@ BELONGS ya.make include/boost/asio/experimental/detail/channel_send_functions.hpp [7:8] include/boost/asio/experimental/detail/channel_send_op.hpp [7:8] include/boost/asio/experimental/detail/channel_service.hpp [7:8] - include/boost/asio/experimental/detail/completion_handler_erasure.hpp [8:9] + include/boost/asio/experimental/detail/coro_completion_handler.hpp [8:9] include/boost/asio/experimental/detail/coro_promise_allocator.hpp [8:9] include/boost/asio/experimental/detail/has_signature.hpp [7:8] include/boost/asio/experimental/detail/impl/channel_service.hpp [7:8] include/boost/asio/experimental/detail/partial_promise.hpp [8:9] include/boost/asio/experimental/impl/as_single.hpp [7:8] include/boost/asio/experimental/impl/channel_error.ipp [7:8] + include/boost/asio/experimental/impl/co_composed.hpp [7:8] include/boost/asio/experimental/impl/coro.hpp [8:9] include/boost/asio/experimental/impl/parallel_group.hpp [7:8] include/boost/asio/experimental/impl/promise.hpp [8:9] include/boost/asio/experimental/impl/use_coro.hpp [8:9] + include/boost/asio/experimental/impl/use_promise.hpp [8:9] include/boost/asio/experimental/parallel_group.hpp [7:8] include/boost/asio/experimental/prepend.hpp [7:8] include/boost/asio/experimental/promise.hpp [8:9] include/boost/asio/experimental/use_coro.hpp [8:9] + include/boost/asio/experimental/use_promise.hpp [8:9] include/boost/asio/file_base.hpp [7:8] include/boost/asio/generic/basic_endpoint.hpp [7:8] include/boost/asio/generic/datagram_protocol.hpp [7:8] @@ -475,6 +483,7 @@ BELONGS ya.make include/boost/asio/handler_continuation_hook.hpp [7:8] include/boost/asio/handler_invoke_hook.hpp [7:8] include/boost/asio/high_resolution_timer.hpp [7:8] + include/boost/asio/impl/any_completion_executor.ipp [7:8] include/boost/asio/impl/any_io_executor.ipp [7:8] include/boost/asio/impl/append.hpp [7:8] include/boost/asio/impl/as_tuple.hpp [7:8] @@ -483,10 +492,10 @@ BELONGS ya.make include/boost/asio/impl/buffered_write_stream.hpp [7:8] include/boost/asio/impl/cancellation_signal.ipp [7:8] include/boost/asio/impl/co_spawn.hpp [7:8] - include/boost/asio/impl/compose.hpp [7:8] include/boost/asio/impl/connect.hpp [7:8] include/boost/asio/impl/connect_pipe.hpp [7:8] include/boost/asio/impl/connect_pipe.ipp [9:10] + include/boost/asio/impl/consign.hpp [7:8] include/boost/asio/impl/defer.hpp [7:8] include/boost/asio/impl/deferred.hpp [7:8] include/boost/asio/impl/detached.hpp [7:8] diff --git a/contrib/restricted/boost/asio/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/asio/.yandex_meta/licenses.list.txt index 630954ed06..30db5a6cb6 100644 --- a/contrib/restricted/boost/asio/.yandex_meta/licenses.list.txt +++ b/contrib/restricted/boost/asio/.yandex_meta/licenses.list.txt @@ -52,5 +52,10 @@ // (klemens dot morgenstern at gmx dot net) +====================COPYRIGHT==================== +// Copyright (c) 2022 Klemens D. Morgenstern +// (klemens dot morgenstern at gmx dot net) + + ====================Public-Domain==================== // Derived from a public domain implementation written by Daniel Casimiro. diff --git a/contrib/restricted/boost/asio/include/boost/asio.hpp b/contrib/restricted/boost/asio/include/boost/asio.hpp index 282fc4c1f1..ee6f0af4cf 100644 --- a/contrib/restricted/boost/asio/include/boost/asio.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio.hpp @@ -17,6 +17,9 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include <boost/asio/any_completion_executor.hpp> +#include <boost/asio/any_completion_handler.hpp> +#include <boost/asio/any_io_executor.hpp> #include <boost/asio/append.hpp> #include <boost/asio/as_tuple.hpp> #include <boost/asio/associated_allocator.hpp> @@ -64,6 +67,7 @@ #include <boost/asio/compose.hpp> #include <boost/asio/connect.hpp> #include <boost/asio/connect_pipe.hpp> +#include <boost/asio/consign.hpp> #include <boost/asio/coroutine.hpp> #include <boost/asio/deadline_timer.hpp> #include <boost/asio/defer.hpp> diff --git a/contrib/restricted/boost/asio/include/boost/asio/any_completion_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/any_completion_executor.hpp new file mode 100644 index 0000000000..74933b96d3 --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/any_completion_executor.hpp @@ -0,0 +1,344 @@ +// +// any_completion_executor.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// 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) +// + +#ifndef BOOST_ASIO_ANY_COMPLETION_EXECUTOR_HPP +#define BOOST_ASIO_ANY_COMPLETION_EXECUTOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#if defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) +# include <boost/asio/executor.hpp> +#else // defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) +# include <boost/asio/execution.hpp> +#endif // defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +#if defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) + +typedef executor any_completion_executor; + +#else // defined(BOOST_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::outstanding_work_t::tracked_t>, + * execution::prefer_only<execution::outstanding_work_t::untracked_t> + * execution::prefer_only<execution::relationship_t::fork_t>, + * execution::prefer_only<execution::relationship_t::continuation_t> + * > @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::outstanding_work_t::tracked_t>, + execution::prefer_only<execution::outstanding_work_t::untracked_t>, + execution::prefer_only<execution::relationship_t::fork_t>, + execution::prefer_only<execution::relationship_t::continuation_t> + > +#endif // defined(GENERATING_DOCUMENTATION) +{ +public: +#if !defined(GENERATING_DOCUMENTATION) + typedef execution::any_executor< + execution::prefer_only<execution::outstanding_work_t::tracked_t>, + execution::prefer_only<execution::outstanding_work_t::untracked_t>, + execution::prefer_only<execution::relationship_t::fork_t>, + execution::prefer_only<execution::relationship_t::continuation_t> + > base_type; + + typedef void supportable_properties_type( + execution::prefer_only<execution::outstanding_work_t::tracked_t>, + execution::prefer_only<execution::outstanding_work_t::untracked_t>, + execution::prefer_only<execution::relationship_t::fork_t>, + execution::prefer_only<execution::relationship_t::continuation_t> + ); +#endif // !defined(GENERATING_DOCUMENTATION) + + /// Default constructor. + BOOST_ASIO_DECL any_completion_executor() BOOST_ASIO_NOEXCEPT; + + /// Construct in an empty state. Equivalent effects to default constructor. + BOOST_ASIO_DECL any_completion_executor(nullptr_t) BOOST_ASIO_NOEXCEPT; + + /// Copy constructor. + BOOST_ASIO_DECL any_completion_executor( + const any_completion_executor& e) BOOST_ASIO_NOEXCEPT; + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move constructor. + BOOST_ASIO_DECL any_completion_executor( + any_completion_executor&& e) BOOST_ASIO_NOEXCEPT; +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Construct to point to the same target as another any_executor. +#if defined(GENERATING_DOCUMENTATION) + template <class... OtherSupportableProperties> + any_completion_executor( + execution::any_executor<OtherSupportableProperties...> e); +#else // defined(GENERATING_DOCUMENTATION) + template <typename OtherAnyExecutor> + any_completion_executor(OtherAnyExecutor e, + typename constraint< + conditional< + !is_same<OtherAnyExecutor, any_completion_executor>::value + && is_base_of<execution::detail::any_executor_base, + OtherAnyExecutor>::value, + typename execution::detail::supportable_properties< + 0, supportable_properties_type>::template + is_valid_target<OtherAnyExecutor>, + false_type + >::type::value + >::type = 0) + : base_type(BOOST_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 <class... OtherSupportableProperties> + any_completion_executor(std::nothrow_t, + execution::any_executor<OtherSupportableProperties...> e); +#else // defined(GENERATING_DOCUMENTATION) + template <typename OtherAnyExecutor> + any_completion_executor(std::nothrow_t, OtherAnyExecutor e, + typename constraint< + conditional< + !is_same<OtherAnyExecutor, any_completion_executor>::value + && is_base_of<execution::detail::any_executor_base, + OtherAnyExecutor>::value, + typename execution::detail::supportable_properties< + 0, supportable_properties_type>::template + is_valid_target<OtherAnyExecutor>, + false_type + >::type::value + >::type = 0) BOOST_ASIO_NOEXCEPT + : base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(e)) + { + } +#endif // defined(GENERATING_DOCUMENTATION) + + /// Construct to point to the same target as another any_executor. + BOOST_ASIO_DECL any_completion_executor(std::nothrow_t, + const any_completion_executor& e) BOOST_ASIO_NOEXCEPT; + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Construct to point to the same target as another any_executor. + BOOST_ASIO_DECL any_completion_executor(std::nothrow_t, + any_completion_executor&& e) BOOST_ASIO_NOEXCEPT; +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Construct a polymorphic wrapper for the specified executor. +#if defined(GENERATING_DOCUMENTATION) + template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> + any_completion_executor(Executor e); +#else // defined(GENERATING_DOCUMENTATION) + template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> + any_completion_executor(Executor e, + typename constraint< + conditional< + !is_same<Executor, any_completion_executor>::value + && !is_base_of<execution::detail::any_executor_base, + Executor>::value, + execution::detail::is_valid_target_executor< + Executor, supportable_properties_type>, + false_type + >::type::value + >::type = 0) + : base_type(BOOST_ASIO_MOVE_CAST(Executor)(e)) + { + } +#endif // defined(GENERATING_DOCUMENTATION) + + /// Construct a polymorphic wrapper for the specified executor. +#if defined(GENERATING_DOCUMENTATION) + template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> + any_completion_executor(std::nothrow_t, Executor e); +#else // defined(GENERATING_DOCUMENTATION) + template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> + any_completion_executor(std::nothrow_t, Executor e, + typename constraint< + conditional< + !is_same<Executor, any_completion_executor>::value + && !is_base_of<execution::detail::any_executor_base, + Executor>::value, + execution::detail::is_valid_target_executor< + Executor, supportable_properties_type>, + false_type + >::type::value + >::type = 0) BOOST_ASIO_NOEXCEPT + : base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(Executor)(e)) + { + } +#endif // defined(GENERATING_DOCUMENTATION) + + /// Assignment operator. + BOOST_ASIO_DECL any_completion_executor& operator=( + const any_completion_executor& e) BOOST_ASIO_NOEXCEPT; + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move assignment operator. + BOOST_ASIO_DECL any_completion_executor& operator=( + any_completion_executor&& e) BOOST_ASIO_NOEXCEPT; +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Assignment operator that sets the polymorphic wrapper to the empty state. + BOOST_ASIO_DECL any_completion_executor& operator=(nullptr_t); + + /// Destructor. + BOOST_ASIO_DECL ~any_completion_executor(); + + /// Swap targets with another polymorphic wrapper. + BOOST_ASIO_DECL void swap(any_completion_executor& other) BOOST_ASIO_NOEXCEPT; + + /// Obtain a polymorphic wrapper with the specified property. + /** + * Do not call this function directly. It is intended for use with the + * boost::asio::require and boost::asio::prefer customisation points. + * + * For example: + * @code any_completion_executor ex = ...; + * auto ex2 = boost::asio::require(ex, execution::relationship.fork); @endcode + */ + template <typename Property> + any_completion_executor require(const Property& p, + typename constraint< + traits::require_member<const base_type&, const Property&>::is_valid + >::type = 0) const + { + return static_cast<const base_type&>(*this).require(p); + } + + /// Obtain a polymorphic wrapper with the specified property. + /** + * Do not call this function directly. It is intended for use with the + * boost::asio::prefer customisation point. + * + * For example: + * @code any_completion_executor ex = ...; + * auto ex2 = boost::asio::prefer(ex, execution::relationship.fork); @endcode + */ + template <typename Property> + any_completion_executor prefer(const Property& p, + typename constraint< + traits::prefer_member<const base_type&, const Property&>::is_valid + >::type = 0) const + { + return static_cast<const base_type&>(*this).prefer(p); + } +}; + +#if !defined(GENERATING_DOCUMENTATION) + +template <> +BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer( + const execution::outstanding_work_t::tracked_t&, int) const; + +template <> +BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer( + const execution::outstanding_work_t::untracked_t&, int) const; + +template <> +BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer( + const execution::relationship_t::fork_t&, int) const; + +template <> +BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer( + const execution::relationship_t::continuation_t&, int) const; + +namespace traits { + +#if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) + +template <> +struct equality_comparable<any_completion_executor> +{ + static const bool is_valid = true; + static const bool is_noexcept = true; +}; + +#endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) + +#if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) + +template <typename F> +struct execute_member<any_completion_executor, F> +{ + static const bool is_valid = true; + static const bool is_noexcept = false; + typedef void result_type; +}; + +#endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) + +#if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) + +template <typename Prop> +struct query_member<any_completion_executor, Prop> : + query_member<any_completion_executor::base_type, Prop> +{ +}; + +#endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) + +#if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) + +template <typename Prop> +struct require_member<any_completion_executor, Prop> : + require_member<any_completion_executor::base_type, Prop> +{ + typedef any_completion_executor result_type; +}; + +#endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) + +#if !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT) + +template <typename Prop> +struct prefer_member<any_completion_executor, Prop> : + prefer_member<any_completion_executor::base_type, Prop> +{ + typedef any_completion_executor result_type; +}; + +#endif // !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT) + +} // namespace traits + +#endif // !defined(GENERATING_DOCUMENTATION) + +#endif // defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) \ + && !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) +# include <boost/asio/impl/any_completion_executor.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + // && !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) + +#endif // BOOST_ASIO_ANY_COMPLETION_EXECUTOR_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/any_completion_handler.hpp b/contrib/restricted/boost/asio/include/boost/asio/any_completion_handler.hpp new file mode 100644 index 0000000000..b7510a8241 --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/any_completion_handler.hpp @@ -0,0 +1,686 @@ +// +// any_completion_handler.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// 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) +// + +#ifndef BOOST_ASIO_ANY_COMPLETION_HANDLER_HPP +#define BOOST_ASIO_ANY_COMPLETION_HANDLER_HPP + +#include <boost/asio/detail/config.hpp> + +#if (defined(BOOST_ASIO_HAS_STD_TUPLE) \ + && defined(BOOST_ASIO_HAS_MOVE) \ + && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) \ + || defined(GENERATING_DOCUMENTATION) + +#include <cstring> +#include <functional> +#include <memory> +#include <utility> +#include <boost/asio/any_completion_executor.hpp> +#include <boost/asio/associated_allocator.hpp> +#include <boost/asio/associated_cancellation_slot.hpp> +#include <boost/asio/associated_executor.hpp> +#include <boost/asio/cancellation_state.hpp> +#include <boost/asio/recycling_allocator.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +class any_completion_handler_impl_base +{ +public: + template <typename S> + explicit any_completion_handler_impl_base(S&& slot) + : cancel_state_(BOOST_ASIO_MOVE_CAST(S)(slot), enable_total_cancellation()) + { + } + + cancellation_slot get_cancellation_slot() const BOOST_ASIO_NOEXCEPT + { + return cancel_state_.slot(); + } + +private: + cancellation_state cancel_state_; +}; + +template <typename Handler> +class any_completion_handler_impl : + public any_completion_handler_impl_base +{ +public: + template <typename S, typename H> + any_completion_handler_impl(S&& slot, H&& h) + : any_completion_handler_impl_base(BOOST_ASIO_MOVE_CAST(S)(slot)), + handler_(BOOST_ASIO_MOVE_CAST(H)(h)) + { + } + + struct uninit_deleter + { + typename std::allocator_traits< + associated_allocator_t<Handler, + boost::asio::recycling_allocator<void>>>::template + rebind_alloc<any_completion_handler_impl> alloc; + + void operator()(any_completion_handler_impl* ptr) + { + std::allocator_traits<decltype(alloc)>::deallocate(alloc, ptr, 1); + } + }; + + struct deleter + { + typename std::allocator_traits< + associated_allocator_t<Handler, + boost::asio::recycling_allocator<void>>>::template + rebind_alloc<any_completion_handler_impl> alloc; + + void operator()(any_completion_handler_impl* ptr) + { + std::allocator_traits<decltype(alloc)>::destroy(alloc, ptr); + std::allocator_traits<decltype(alloc)>::deallocate(alloc, ptr, 1); + } + }; + + template <typename S, typename H> + static any_completion_handler_impl* create(S&& slot, H&& h) + { + uninit_deleter d{ + (get_associated_allocator)(h, + boost::asio::recycling_allocator<void>())}; + + std::unique_ptr<any_completion_handler_impl, uninit_deleter> uninit_ptr( + std::allocator_traits<decltype(d.alloc)>::allocate(d.alloc, 1), d); + + any_completion_handler_impl* ptr = + new (uninit_ptr.get()) any_completion_handler_impl( + BOOST_ASIO_MOVE_CAST(S)(slot), BOOST_ASIO_MOVE_CAST(H)(h)); + + uninit_ptr.release(); + return ptr; + } + + void destroy() + { + deleter d{ + (get_associated_allocator)(handler_, + boost::asio::recycling_allocator<void>())}; + + d(this); + } + + any_completion_executor executor( + const any_completion_executor& candidate) const BOOST_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<Handler, + boost::asio::recycling_allocator<void>>>::template + rebind_alloc<unsigned char> alloc( + (get_associated_allocator)(handler_, + boost::asio::recycling_allocator<void>())); + + std::size_t space = size + align - 1; + unsigned char* base = + std::allocator_traits<decltype(alloc)>::allocate( + alloc, space + sizeof(std::ptrdiff_t)); + + void* p = base; + if (detail::align(align, size, p, space)) + { + std::ptrdiff_t off = static_cast<unsigned char*>(p) - base; + std::memcpy(static_cast<unsigned char*>(p) + size, &off, sizeof(off)); + return p; + } + + std::bad_alloc ex; + boost::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<Handler, + boost::asio::recycling_allocator<void>>>::template + rebind_alloc<unsigned char> alloc( + (get_associated_allocator)(handler_, + boost::asio::recycling_allocator<void>())); + + std::ptrdiff_t off; + std::memcpy(&off, static_cast<unsigned char*>(p) + size, sizeof(off)); + unsigned char* base = static_cast<unsigned char*>(p) - off; + + std::allocator_traits<decltype(alloc)>::deallocate( + alloc, base, size + align -1 + sizeof(std::ptrdiff_t)); + } + } + + template <typename... Args> + void call(Args&&... args) + { + deleter d{ + (get_associated_allocator)(handler_, + boost::asio::recycling_allocator<void>())}; + + std::unique_ptr<any_completion_handler_impl, deleter> ptr(this, d); + Handler handler(BOOST_ASIO_MOVE_CAST(Handler)(handler_)); + ptr.reset(); + + BOOST_ASIO_MOVE_CAST(Handler)(handler)( + BOOST_ASIO_MOVE_CAST(Args)(args)...); + } + +private: + Handler handler_; +}; + +template <typename Signature> +class any_completion_handler_call_fn; + +template <typename R, typename... Args> +class any_completion_handler_call_fn<R(Args...)> +{ +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, BOOST_ASIO_MOVE_CAST(Args)(args)...); + } + + template <typename Handler> + static void impl(any_completion_handler_impl_base* impl, Args... args) + { + static_cast<any_completion_handler_impl<Handler>*>(impl)->call( + BOOST_ASIO_MOVE_CAST(Args)(args)...); + } + +private: + type call_fn_; +}; + +template <typename... Signatures> +class any_completion_handler_call_fns; + +template <typename Signature> +class any_completion_handler_call_fns<Signature> : + public any_completion_handler_call_fn<Signature> +{ +public: + using any_completion_handler_call_fn< + Signature>::any_completion_handler_call_fn; + using any_completion_handler_call_fn<Signature>::call; +}; + +template <typename Signature, typename... Signatures> +class any_completion_handler_call_fns<Signature, Signatures...> : + public any_completion_handler_call_fn<Signature>, + public any_completion_handler_call_fns<Signatures...> +{ +public: + template <typename CallFn, typename... CallFns> + constexpr any_completion_handler_call_fns(CallFn fn, CallFns... fns) + : any_completion_handler_call_fn<Signature>(fn), + any_completion_handler_call_fns<Signatures...>(fns...) + { + } + + using any_completion_handler_call_fn<Signature>::call; + using any_completion_handler_call_fns<Signatures...>::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 <typename Handler> + static void impl(any_completion_handler_impl_base* impl) + { + static_cast<any_completion_handler_impl<Handler>*>(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 <typename Handler> + static any_completion_executor impl(any_completion_handler_impl_base* impl, + const any_completion_executor& candidate) + { + return static_cast<any_completion_handler_impl<Handler>*>(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 <typename Handler> + static void* impl(any_completion_handler_impl_base* impl, + std::size_t size, std::size_t align) + { + return static_cast<any_completion_handler_impl<Handler>*>(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 <typename Handler> + static void impl(any_completion_handler_impl_base* impl, + void* p, std::size_t size, std::size_t align) + { + static_cast<any_completion_handler_impl<Handler>*>(impl)->deallocate( + p, size, align); + } + +private: + type deallocate_fn_; +}; + +template <typename... Signatures> +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<Signatures...> +{ +public: + template <typename... CallFns> + 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<Signatures...>(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<Signatures...>::call; +}; + +template <typename Handler, typename... Signatures> +struct any_completion_handler_fn_table_instance +{ + static constexpr any_completion_handler_fn_table<Signatures...> + value = any_completion_handler_fn_table<Signatures...>( + &any_completion_handler_destroy_fn::impl<Handler>, + &any_completion_handler_executor_fn::impl<Handler>, + &any_completion_handler_allocate_fn::impl<Handler>, + &any_completion_handler_deallocate_fn::impl<Handler>, + &any_completion_handler_call_fn<Signatures>::template impl<Handler>...); +}; + +template <typename Handler, typename... Signatures> +constexpr any_completion_handler_fn_table<Signatures...> +any_completion_handler_fn_table_instance<Handler, Signatures...>::value; + +} // namespace detail + +template <typename... Signatures> +class any_completion_handler; + +template <typename T, typename... Signatures> +class any_completion_handler_allocator +{ +private: + template <typename...> + friend class any_completion_handler; + + template <typename, typename...> + friend class any_completion_handler_allocator; + + const detail::any_completion_handler_fn_table<Signatures...>* fn_table_; + detail::any_completion_handler_impl_base* impl_; + + constexpr any_completion_handler_allocator(int, + const any_completion_handler<Signatures...>& h) BOOST_ASIO_NOEXCEPT + : fn_table_(h.fn_table_), + impl_(h.impl_) + { + } + +public: + typedef T value_type; + + template <typename U> + struct rebind + { + typedef any_completion_handler_allocator<U, Signatures...> other; + }; + + template <typename U> + constexpr any_completion_handler_allocator( + const any_completion_handler_allocator<U, Signatures...>& a) + BOOST_ASIO_NOEXCEPT + : fn_table_(a.fn_table_), + impl_(a.impl_) + { + } + + constexpr bool operator==( + const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT + { + return fn_table_ == other.fn_table_ && impl_ == other.impl_; + } + + constexpr bool operator!=( + const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT + { + return fn_table_ != other.fn_table_ || impl_ != other.impl_; + } + + T* allocate(std::size_t n) const + { + return static_cast<T*>( + 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 <typename... Signatures> +class any_completion_handler_allocator<void, Signatures...> +{ +private: + template <typename...> + friend class any_completion_handler; + + template <typename, typename...> + friend class any_completion_handler_allocator; + + const detail::any_completion_handler_fn_table<Signatures...>* fn_table_; + detail::any_completion_handler_impl_base* impl_; + + constexpr any_completion_handler_allocator(int, + const any_completion_handler<Signatures...>& h) BOOST_ASIO_NOEXCEPT + : fn_table_(h.fn_table_), + impl_(h.impl_) + { + } + +public: + typedef void value_type; + + template <typename U> + struct rebind + { + typedef any_completion_handler_allocator<U, Signatures...> other; + }; + + template <typename U> + constexpr any_completion_handler_allocator( + const any_completion_handler_allocator<U, Signatures...>& a) + BOOST_ASIO_NOEXCEPT + : fn_table_(a.fn_table_), + impl_(a.impl_) + { + } + + constexpr bool operator==( + const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT + { + return fn_table_ == other.fn_table_ && impl_ == other.impl_; + } + + constexpr bool operator!=( + const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT + { + return fn_table_ != other.fn_table_ || impl_ != other.impl_; + } +}; + +template <typename... Signatures> +class any_completion_handler +{ +private: + template <typename, typename...> + friend class any_completion_handler_allocator; + + template <typename, typename> + friend struct associated_executor; + + const detail::any_completion_handler_fn_table<Signatures...>* fn_table_; + detail::any_completion_handler_impl_base* impl_; + +public: + using allocator_type = any_completion_handler_allocator<void, Signatures...>; + 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 <typename H, typename Handler = typename decay<H>::type> + any_completion_handler(H&& h) + : fn_table_( + &detail::any_completion_handler_fn_table_instance< + Handler, Signatures...>::value), + impl_(detail::any_completion_handler_impl<Handler>::create( + (get_associated_cancellation_slot)(h), BOOST_ASIO_MOVE_CAST(H)(h))) + { + } + + any_completion_handler(any_completion_handler&& other) BOOST_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) BOOST_ASIO_NOEXCEPT + { + any_completion_handler(other).swap(*this); + return *this; + } + + any_completion_handler& operator=(nullptr_t) BOOST_ASIO_NOEXCEPT + { + any_completion_handler().swap(*this); + return *this; + } + + ~any_completion_handler() + { + if (impl_) + fn_table_->destroy(impl_); + } + + constexpr explicit operator bool() const BOOST_ASIO_NOEXCEPT + { + return impl_ != nullptr; + } + + constexpr bool operator!() const BOOST_ASIO_NOEXCEPT + { + return impl_ == nullptr; + } + + void swap(any_completion_handler& other) BOOST_ASIO_NOEXCEPT + { + std::swap(fn_table_, other.fn_table_); + std::swap(impl_, other.impl_); + } + + allocator_type get_allocator() const BOOST_ASIO_NOEXCEPT + { + return allocator_type(0, *this); + } + + cancellation_slot_type get_cancellation_slot() const BOOST_ASIO_NOEXCEPT + { + return impl_->get_cancellation_slot(); + } + + template <typename... Args> + auto operator()(Args&&... args) + -> decltype(fn_table_->call(impl_, BOOST_ASIO_MOVE_CAST(Args)(args)...)) + { + if (detail::any_completion_handler_impl_base* impl = impl_) + { + impl_ = nullptr; + return fn_table_->call(impl, BOOST_ASIO_MOVE_CAST(Args)(args)...); + } + std::bad_function_call ex; + boost::asio::detail::throw_exception(ex); + } + + friend constexpr bool operator==( + const any_completion_handler& a, nullptr_t) BOOST_ASIO_NOEXCEPT + { + return a.impl_ == nullptr; + } + + friend constexpr bool operator==( + nullptr_t, const any_completion_handler& b) BOOST_ASIO_NOEXCEPT + { + return nullptr == b.impl_; + } + + friend constexpr bool operator!=( + const any_completion_handler& a, nullptr_t) BOOST_ASIO_NOEXCEPT + { + return a.impl_ != nullptr; + } + + friend constexpr bool operator!=( + nullptr_t, const any_completion_handler& b) BOOST_ASIO_NOEXCEPT + { + return nullptr != b.impl_; + } +}; + +template <typename... Signatures, typename Candidate> +struct associated_executor<any_completion_handler<Signatures...>, Candidate> +{ + using type = any_completion_executor; + + static type get(const any_completion_handler<Signatures...>& handler, + const Candidate& candidate = Candidate()) BOOST_ASIO_NOEXCEPT + { + return handler.fn_table_->executor(handler.impl_, + any_completion_executor(std::nothrow, candidate)); + } +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // (defined(BOOST_ASIO_HAS_STD_TUPLE) + // && defined(BOOST_ASIO_HAS_MOVE) + // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_ANY_COMPLETION_HANDLER_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/any_io_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/any_io_executor.hpp index 6dc8731fdc..523ae94d22 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/any_io_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/any_io_executor.hpp @@ -124,6 +124,40 @@ public: } #endif // defined(GENERATING_DOCUMENTATION) + /// Construct to point to the same target as another any_executor. +#if defined(GENERATING_DOCUMENTATION) + template <class... OtherSupportableProperties> + any_io_executor(std::nothrow_t, + execution::any_executor<OtherSupportableProperties...> e); +#else // defined(GENERATING_DOCUMENTATION) + template <typename OtherAnyExecutor> + any_io_executor(std::nothrow_t, OtherAnyExecutor e, + typename constraint< + conditional< + !is_same<OtherAnyExecutor, any_io_executor>::value + && is_base_of<execution::detail::any_executor_base, + OtherAnyExecutor>::value, + typename execution::detail::supportable_properties< + 0, supportable_properties_type>::template + is_valid_target<OtherAnyExecutor>, + false_type + >::type::value + >::type = 0) BOOST_ASIO_NOEXCEPT + : base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(e)) + { + } +#endif // defined(GENERATING_DOCUMENTATION) + + /// Construct to point to the same target as another any_executor. + BOOST_ASIO_DECL any_io_executor(std::nothrow_t, + const any_io_executor& e) BOOST_ASIO_NOEXCEPT; + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Construct to point to the same target as another any_executor. + BOOST_ASIO_DECL any_io_executor(std::nothrow_t, + any_io_executor&& e) BOOST_ASIO_NOEXCEPT; +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Construct a polymorphic wrapper for the specified executor. #if defined(GENERATING_DOCUMENTATION) template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> @@ -146,6 +180,28 @@ public: } #endif // defined(GENERATING_DOCUMENTATION) + /// Construct a polymorphic wrapper for the specified executor. +#if defined(GENERATING_DOCUMENTATION) + template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> + any_io_executor(std::nothrow_t, Executor e); +#else // defined(GENERATING_DOCUMENTATION) + template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> + any_io_executor(std::nothrow_t, Executor e, + typename constraint< + conditional< + !is_same<Executor, any_io_executor>::value + && !is_base_of<execution::detail::any_executor_base, + Executor>::value, + execution::detail::is_valid_target_executor< + Executor, supportable_properties_type>, + false_type + >::type::value + >::type = 0) BOOST_ASIO_NOEXCEPT + : base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(Executor)(e)) + { + } +#endif // defined(GENERATING_DOCUMENTATION) + /// Assignment operator. BOOST_ASIO_DECL any_io_executor& operator=( const any_io_executor& e) BOOST_ASIO_NOEXCEPT; diff --git a/contrib/restricted/boost/asio/include/boost/asio/associated_allocator.hpp b/contrib/restricted/boost/asio/include/boost/asio/associated_allocator.hpp index 01c020269b..ed085703ef 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/associated_allocator.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/associated_allocator.hpp @@ -43,37 +43,53 @@ struct has_allocator_type<T, { }; -template <typename T, typename E, typename = void, typename = void> +template <typename T, typename A, typename = void, typename = void> struct associated_allocator_impl { - typedef E type; + typedef void asio_associated_allocator_is_unspecialised; - static type get(const T&, const E& e) BOOST_ASIO_NOEXCEPT + typedef A type; + + static type get(const T&) BOOST_ASIO_NOEXCEPT + { + return type(); + } + + static const type& get(const T&, const A& a) BOOST_ASIO_NOEXCEPT { - return e; + return a; } }; -template <typename T, typename E> -struct associated_allocator_impl<T, E, +template <typename T, typename A> +struct associated_allocator_impl<T, A, typename void_type<typename T::allocator_type>::type> { typedef typename T::allocator_type type; - static type get(const T& t, const E&) BOOST_ASIO_NOEXCEPT + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const T& t) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_allocator())) + { + return t.get_allocator(); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const T& t, const A&) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_allocator())) { return t.get_allocator(); } }; -template <typename T, typename E> -struct associated_allocator_impl<T, E, +template <typename T, typename A> +struct associated_allocator_impl<T, A, typename enable_if< !has_allocator_type<T>::value >::type, typename void_type< - typename associator<associated_allocator, T, E>::type - >::type> : associator<associated_allocator, T, E> + typename associator<associated_allocator, T, A>::type + >::type> : associator<associated_allocator, T, A> { }; @@ -93,29 +109,32 @@ struct associated_allocator_impl<T, E, * Allocator requirements. * * @li Provide a noexcept static member function named @c get, callable as @c - * get(t) and with return type @c type. + * 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,a) and with return type @c type. + * get(t,a) and with return type @c type or a (possibly const) reference to @c + * type. */ template <typename T, typename Allocator = std::allocator<void> > struct associated_allocator +#if !defined(GENERATING_DOCUMENTATION) + : detail::associated_allocator_impl<T, Allocator> +#endif // !defined(GENERATING_DOCUMENTATION) { +#if defined(GENERATING_DOCUMENTATION) /// If @c T has a nested type @c allocator_type, <tt>T::allocator_type</tt>. /// Otherwise @c Allocator. -#if defined(GENERATING_DOCUMENTATION) typedef see_below type; -#else // defined(GENERATING_DOCUMENTATION) - typedef typename detail::associated_allocator_impl<T, Allocator>::type type; -#endif // defined(GENERATING_DOCUMENTATION) + + /// If @c T has a nested type @c allocator_type, returns + /// <tt>t.get_allocator()</tt>. Otherwise returns @c type(). + static decltype(auto) get(const T& t) BOOST_ASIO_NOEXCEPT; /// If @c T has a nested type @c allocator_type, returns /// <tt>t.get_allocator()</tt>. Otherwise returns @c a. - static type get(const T& t, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT - { - return detail::associated_allocator_impl<T, Allocator>::get(t, a); - } + static decltype(auto) get(const T& t, const Allocator& a) BOOST_ASIO_NOEXCEPT; +#endif // defined(GENERATING_DOCUMENTATION) }; /// Helper function to obtain an object's associated allocator. @@ -134,8 +153,11 @@ get_associated_allocator(const T& t) BOOST_ASIO_NOEXCEPT * @returns <tt>associated_allocator<T, Allocator>::get(t, a)</tt> */ template <typename T, typename Allocator> -BOOST_ASIO_NODISCARD inline typename associated_allocator<T, Allocator>::type +BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename associated_allocator<T, Allocator>::type) get_associated_allocator(const T& t, const Allocator& a) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + associated_allocator<T, Allocator>::get(t, a))) { return associated_allocator<T, Allocator>::get(t, a); } @@ -148,12 +170,37 @@ using associated_allocator_t #endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) +namespace detail { + +template <typename T, typename A, typename = void> +struct associated_allocator_forwarding_base +{ +}; + +template <typename T, typename A> +struct associated_allocator_forwarding_base<T, A, + typename enable_if< + is_same< + typename associated_allocator<T, + A>::asio_associated_allocator_is_unspecialised, + void + >::value + >::type> +{ + typedef void asio_associated_allocator_is_unspecialised; +}; + +} // namespace detail + #if defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) \ || defined(GENERATING_DOCUMENTATION) /// Specialisation of associated_allocator for @c std::reference_wrapper. template <typename T, typename Allocator> struct associated_allocator<reference_wrapper<T>, Allocator> +#if !defined(GENERATING_DOCUMENTATION) + : detail::associated_allocator_forwarding_base<T, Allocator> +#endif // !defined(GENERATING_DOCUMENTATION) { /// Forwards @c type to the associator specialisation for the unwrapped type /// @c T. @@ -161,8 +208,17 @@ struct associated_allocator<reference_wrapper<T>, Allocator> /// Forwards the request to get the allocator to the associator specialisation /// for the unwrapped type @c T. - static type get(reference_wrapper<T> t, - const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT + static type get(reference_wrapper<T> t) BOOST_ASIO_NOEXCEPT + { + return associated_allocator<T, Allocator>::get(t.get()); + } + + /// Forwards the request to get the allocator to the associator specialisation + /// for the unwrapped type @c T. + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + reference_wrapper<T> t, const Allocator& a) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + associated_allocator<T, Allocator>::get(t.get(), a))) { return associated_allocator<T, Allocator>::get(t.get(), a); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/associated_cancellation_slot.hpp b/contrib/restricted/boost/asio/include/boost/asio/associated_cancellation_slot.hpp index f3f52e7337..3ee637ff2f 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/associated_cancellation_slot.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/associated_cancellation_slot.hpp @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/cancellation_signal.hpp> +#include <boost/asio/detail/functional.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> @@ -49,7 +50,12 @@ struct associated_cancellation_slot_impl typedef S type; - static type get(const T&, const S& s = S()) BOOST_ASIO_NOEXCEPT + static type get(const T&) BOOST_ASIO_NOEXCEPT + { + return type(); + } + + static const type& get(const T&, const S& s) BOOST_ASIO_NOEXCEPT { return s; } @@ -61,7 +67,16 @@ struct associated_cancellation_slot_impl<T, S, { typedef typename T::cancellation_slot_type type; - static type get(const T& t, const S& = S()) BOOST_ASIO_NOEXCEPT + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const T& t) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_cancellation_slot())) + { + return t.get_cancellation_slot(); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const T& t, const S&) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_cancellation_slot())) { return t.get_cancellation_slot(); } @@ -94,10 +109,12 @@ struct associated_cancellation_slot_impl<T, S, * CancellationSlot requirements. * * @li Provide a noexcept static member function named @c get, callable as @c - * get(t) and with return type @c type. + * 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,s) and with return type @c type. + * get(t,s) and with return type @c type or a (possibly const) reference to @c + * type. */ template <typename T, typename CancellationSlot = cancellation_slot> struct associated_cancellation_slot @@ -112,9 +129,13 @@ struct associated_cancellation_slot typedef see_below type; /// If @c T has a nested type @c cancellation_slot_type, returns + /// <tt>t.get_cancellation_slot()</tt>. Otherwise returns @c type(). + static decltype(auto) get(const T& t) BOOST_ASIO_NOEXCEPT; + + /// If @c T has a nested type @c cancellation_slot_type, returns /// <tt>t.get_cancellation_slot()</tt>. Otherwise returns @c s. - static type get(const T& t, - const CancellationSlot& s = CancellationSlot()) BOOST_ASIO_NOEXCEPT; + static decltype(auto) get(const T& t, + const CancellationSlot& s) BOOST_ASIO_NOEXCEPT; #endif // defined(GENERATING_DOCUMENTATION) }; @@ -135,10 +156,12 @@ get_associated_cancellation_slot(const T& t) BOOST_ASIO_NOEXCEPT * CancellationSlot>::get(t, st)</tt> */ template <typename T, typename CancellationSlot> -BOOST_ASIO_NODISCARD inline -typename associated_cancellation_slot<T, CancellationSlot>::type +BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename associated_cancellation_slot<T, CancellationSlot>::type) get_associated_cancellation_slot(const T& t, const CancellationSlot& st) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + associated_cancellation_slot<T, CancellationSlot>::get(t, st))) { return associated_cancellation_slot<T, CancellationSlot>::get(t, st); } @@ -172,6 +195,43 @@ struct associated_cancellation_slot_forwarding_base<T, S, }; } // namespace detail + +#if defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) \ + || defined(GENERATING_DOCUMENTATION) + +/// Specialisation of associated_cancellation_slot for @c +/// std::reference_wrapper. +template <typename T, typename CancellationSlot> +struct associated_cancellation_slot<reference_wrapper<T>, CancellationSlot> +#if !defined(GENERATING_DOCUMENTATION) + : detail::associated_cancellation_slot_forwarding_base<T, CancellationSlot> +#endif // !defined(GENERATING_DOCUMENTATION) +{ + /// Forwards @c type to the associator specialisation for the unwrapped type + /// @c T. + typedef typename associated_cancellation_slot<T, CancellationSlot>::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> t) BOOST_ASIO_NOEXCEPT + { + return associated_cancellation_slot<T, CancellationSlot>::get(t.get()); + } + + /// Forwards the request to get the cancellation slot to the associator + /// specialisation for the unwrapped type @c T. + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(reference_wrapper<T> t, + const CancellationSlot& s = CancellationSlot()) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + associated_cancellation_slot<T, CancellationSlot>::get(t.get(), s))) + { + return associated_cancellation_slot<T, CancellationSlot>::get(t.get(), s); + } +}; + +#endif // defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) + // || defined(GENERATING_DOCUMENTATION) + } // namespace asio } // namespace boost diff --git a/contrib/restricted/boost/asio/include/boost/asio/associated_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/associated_executor.hpp index 02738aac82..a110182cbf 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/associated_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/associated_executor.hpp @@ -52,7 +52,12 @@ struct associated_executor_impl typedef E type; - static type get(const T&, const E& e = E()) BOOST_ASIO_NOEXCEPT + static type get(const T&) BOOST_ASIO_NOEXCEPT + { + return type(); + } + + static const type& get(const T&, const E& e) BOOST_ASIO_NOEXCEPT { return e; } @@ -64,7 +69,16 @@ struct associated_executor_impl<T, E, { typedef typename T::executor_type type; - static type get(const T& t, const E& = E()) BOOST_ASIO_NOEXCEPT + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const T& t) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_executor())) + { + return t.get_executor(); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const T& t, const E&) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_executor())) { return t.get_executor(); } @@ -97,10 +111,12 @@ struct associated_executor_impl<T, E, * Executor requirements. * * @li Provide a noexcept static member function named @c get, callable as @c - * get(t) and with return type @c type. + * 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. + * get(t,e) and with return type @c type or a (possibly const) reference to @c + * type. */ template <typename T, typename Executor = system_executor> struct associated_executor @@ -114,9 +130,12 @@ struct associated_executor typedef see_below type; /// If @c T has a nested type @c executor_type, returns + /// <tt>t.get_executor()</tt>. Otherwise returns @c type(). + static decltype(auto) get(const T& t) BOOST_ASIO_NOEXCEPT; + + /// If @c T has a nested type @c executor_type, returns /// <tt>t.get_executor()</tt>. Otherwise returns @c ex. - static type get(const T& t, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT; + static decltype(auto) get(const T& t, const Executor& ex) BOOST_ASIO_NOEXCEPT; #endif // defined(GENERATING_DOCUMENTATION) }; @@ -136,11 +155,14 @@ get_associated_executor(const T& t) BOOST_ASIO_NOEXCEPT * @returns <tt>associated_executor<T, Executor>::get(t, ex)</tt> */ template <typename T, typename Executor> -BOOST_ASIO_NODISCARD inline typename associated_executor<T, Executor>::type +BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename associated_executor<T, Executor>::type) get_associated_executor(const T& t, const Executor& ex, typename constraint< is_executor<Executor>::value || execution::is_executor<Executor>::value >::type = 0) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + associated_executor<T, Executor>::get(t, ex))) { return associated_executor<T, Executor>::get(t, ex); } @@ -151,11 +173,15 @@ get_associated_executor(const T& t, const Executor& ex, * ExecutionContext::executor_type>::get(t, ctx.get_executor())</tt> */ template <typename T, typename ExecutionContext> -BOOST_ASIO_NODISCARD inline typename associated_executor<T, - typename ExecutionContext::executor_type>::type +BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename associated_executor<T, + typename ExecutionContext::executor_type>::type) get_associated_executor(const T& t, ExecutionContext& ctx, typename constraint<is_convertible<ExecutionContext&, execution_context&>::value>::type = 0) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + associated_executor<T, + typename ExecutionContext::executor_type>::get(t, ctx.get_executor()))) { return associated_executor<T, typename ExecutionContext::executor_type>::get(t, ctx.get_executor()); @@ -206,8 +232,17 @@ struct associated_executor<reference_wrapper<T>, Executor> /// Forwards the request to get the executor to the associator specialisation /// for the unwrapped type @c T. - static type get(reference_wrapper<T> t, - const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT + static type get(reference_wrapper<T> t) BOOST_ASIO_NOEXCEPT + { + return associated_executor<T, Executor>::get(t.get()); + } + + /// Forwards the request to get the executor to the associator specialisation + /// for the unwrapped type @c T. + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + reference_wrapper<T> t, const Executor& ex) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + associated_executor<T, Executor>::get(t.get(), ex))) { return associated_executor<T, Executor>::get(t.get(), ex); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_datagram_socket.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_datagram_socket.hpp index cc663910b6..f220951fd0 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_datagram_socket.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_datagram_socket.hpp @@ -1263,7 +1263,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1297,7 +1297,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1331,7 +1331,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1365,7 +1365,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_deadline_timer.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_deadline_timer.hpp index cb223cd5c9..56672947cc 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_deadline_timer.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_deadline_timer.hpp @@ -318,7 +318,7 @@ public: } /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -680,7 +680,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_file.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_file.hpp index b048081960..79aad88e24 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_file.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_file.hpp @@ -344,7 +344,7 @@ public: #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_random_access_file.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_random_access_file.hpp index f17cdfdce1..a0e52d6d9a 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_random_access_file.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_random_access_file.hpp @@ -635,7 +635,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -668,7 +668,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_raw_socket.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_raw_socket.hpp index 928e61daa9..b9fcc6a3e9 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_raw_socket.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_raw_socket.hpp @@ -1254,7 +1254,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1288,7 +1288,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1322,7 +1322,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1356,7 +1356,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_readable_pipe.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_readable_pipe.hpp index 387c6c4f79..8cb880c6fa 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_readable_pipe.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_readable_pipe.hpp @@ -264,7 +264,7 @@ public: } /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -594,7 +594,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_seq_packet_socket.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_seq_packet_socket.hpp index 1d2b84e87e..5bfe40977b 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_seq_packet_socket.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_seq_packet_socket.hpp @@ -769,7 +769,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -803,7 +803,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_serial_port.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_serial_port.hpp index f3e91bdb7d..ce91b5dfac 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_serial_port.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_serial_port.hpp @@ -354,7 +354,7 @@ public: } /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -928,7 +928,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -961,7 +961,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_signal_set.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_signal_set.hpp index b5f087a900..e37728f004 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_signal_set.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_signal_set.hpp @@ -334,7 +334,7 @@ public: } /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -567,7 +567,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_socket.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_socket.hpp index cb2ea46bc7..32f42f86f6 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_socket.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_socket.hpp @@ -374,7 +374,7 @@ public: #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -1875,7 +1875,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1918,7 +1918,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_socket_acceptor.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_socket_acceptor.hpp index f9a64c2126..6a6dd53220 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_socket_acceptor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_socket_acceptor.hpp @@ -455,7 +455,7 @@ public: } /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -2640,7 +2640,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -2672,7 +2672,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -2706,7 +2706,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_stream_file.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_stream_file.hpp index 86ce225872..3df40da67e 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_stream_file.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_stream_file.hpp @@ -688,7 +688,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -721,7 +721,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_stream_socket.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_stream_socket.hpp index 0445ae05cc..badfee7994 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_stream_socket.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_stream_socket.hpp @@ -1124,7 +1124,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -1158,7 +1158,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_waitable_timer.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_waitable_timer.hpp index 8229b3d15b..302d13a0ee 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_waitable_timer.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_waitable_timer.hpp @@ -382,7 +382,7 @@ public: } /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -799,7 +799,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/basic_writable_pipe.hpp b/contrib/restricted/boost/asio/include/boost/asio/basic_writable_pipe.hpp index 26b20478bf..6d981a052d 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/basic_writable_pipe.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/basic_writable_pipe.hpp @@ -264,7 +264,7 @@ public: } /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -590,7 +590,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/bind_allocator.hpp b/contrib/restricted/boost/asio/include/boost/asio/bind_allocator.hpp index 42c0ae86cc..892c050746 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/bind_allocator.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/bind_allocator.hpp @@ -693,8 +693,16 @@ struct associator<Associator, { typedef typename Associator<T, DefaultCandidate>::type type; - static type get(const allocator_binder<T, Allocator>& b, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static type get(const allocator_binder<T, Allocator>& b) BOOST_ASIO_NOEXCEPT + { + return Associator<T, DefaultCandidate>::get(b.get()); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const allocator_binder<T, Allocator>& b, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<T, DefaultCandidate>::get(b.get(), c))) { return Associator<T, DefaultCandidate>::get(b.get(), c); } @@ -707,8 +715,10 @@ struct associated_allocator< { typedef Allocator type; - static type get(const allocator_binder<T, Allocator>& b, + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const allocator_binder<T, Allocator>& b, const Allocator1& = Allocator1()) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((b.get_allocator())) { return b.get_allocator(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/bind_cancellation_slot.hpp b/contrib/restricted/boost/asio/include/boost/asio/bind_cancellation_slot.hpp index eafb8ec403..55ea7fb649 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/bind_cancellation_slot.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/bind_cancellation_slot.hpp @@ -695,8 +695,17 @@ struct associator<Associator, { typedef typename Associator<T, DefaultCandidate>::type type; - static type get(const cancellation_slot_binder<T, CancellationSlot>& b, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static type get(const cancellation_slot_binder<T, CancellationSlot>& b) + BOOST_ASIO_NOEXCEPT + { + return Associator<T, DefaultCandidate>::get(b.get()); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const cancellation_slot_binder<T, CancellationSlot>& b, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<T, DefaultCandidate>::get(b.get(), c))) { return Associator<T, DefaultCandidate>::get(b.get(), c); } @@ -709,8 +718,10 @@ struct associated_cancellation_slot< { typedef CancellationSlot type; - static type get(const cancellation_slot_binder<T, CancellationSlot>& b, + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const cancellation_slot_binder<T, CancellationSlot>& b, const CancellationSlot1& = CancellationSlot1()) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((b.get_cancellation_slot())) { return b.get_cancellation_slot(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/bind_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/bind_executor.hpp index 5e0f08fd59..8b7d5a213f 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/bind_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/bind_executor.hpp @@ -743,8 +743,16 @@ struct associator<Associator, executor_binder<T, Executor>, DefaultCandidate> { typedef typename Associator<T, DefaultCandidate>::type type; - static type get(const executor_binder<T, Executor>& b, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static type get(const executor_binder<T, Executor>& b) BOOST_ASIO_NOEXCEPT + { + return Associator<T, DefaultCandidate>::get(b.get()); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const executor_binder<T, Executor>& b, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<T, DefaultCandidate>::get(b.get(), c))) { return Associator<T, DefaultCandidate>::get(b.get(), c); } @@ -755,8 +763,10 @@ struct associated_executor<executor_binder<T, Executor>, Executor1> { typedef Executor type; - static type get(const executor_binder<T, Executor>& b, + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( + const executor_binder<T, Executor>& b, const Executor1& = Executor1()) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((b.get_executor())) { return b.get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/compose.hpp b/contrib/restricted/boost/asio/include/boost/asio/compose.hpp index 1a508fca1f..f7740c080f 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/compose.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/compose.hpp @@ -19,16 +19,12 @@ #include <boost/asio/associated_executor.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/base_from_cancellation_state.hpp> +#include <boost/asio/detail/composed_work.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/variadic_templates.hpp> -#include <boost/asio/execution/executor.hpp> -#include <boost/asio/execution/outstanding_work.hpp> -#include <boost/asio/executor_work_guard.hpp> -#include <boost/asio/is_executor.hpp> -#include <boost/asio/system_executor.hpp> #include <boost/asio/detail/push_options.hpp> @@ -36,274 +32,6 @@ namespace boost { namespace asio { namespace detail { -template <typename Executor, typename = void> -class composed_work_guard -{ -public: - typedef typename decay< - typename prefer_result<Executor, - execution::outstanding_work_t::tracked_t - >::type - >::type executor_type; - - composed_work_guard(const Executor& ex) - : executor_(boost::asio::prefer(ex, execution::outstanding_work.tracked)) - { - } - - void reset() - { - } - - executor_type get_executor() const BOOST_ASIO_NOEXCEPT - { - return executor_; - } - -private: - executor_type executor_; -}; - -template <> -struct composed_work_guard<system_executor> -{ -public: - typedef system_executor executor_type; - - composed_work_guard(const system_executor&) - { - } - - void reset() - { - } - - executor_type get_executor() const BOOST_ASIO_NOEXCEPT - { - return system_executor(); - } -}; - -#if !defined(BOOST_ASIO_NO_TS_EXECUTORS) - -template <typename Executor> -struct composed_work_guard<Executor, - typename enable_if< - !execution::is_executor<Executor>::value - >::type> : executor_work_guard<Executor> -{ - composed_work_guard(const Executor& ex) - : executor_work_guard<Executor>(ex) - { - } -}; - -#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) - -template <typename> -struct composed_io_executors; - -template <> -struct composed_io_executors<void()> -{ - composed_io_executors() BOOST_ASIO_NOEXCEPT - : head_(system_executor()) - { - } - - typedef system_executor head_type; - system_executor head_; -}; - -inline composed_io_executors<void()> make_composed_io_executors() -{ - return composed_io_executors<void()>(); -} - -template <typename Head> -struct composed_io_executors<void(Head)> -{ - explicit composed_io_executors(const Head& ex) BOOST_ASIO_NOEXCEPT - : head_(ex) - { - } - - typedef Head head_type; - Head head_; -}; - -template <typename Head> -inline composed_io_executors<void(Head)> -make_composed_io_executors(const Head& head) -{ - return composed_io_executors<void(Head)>(head); -} - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename Head, typename... Tail> -struct composed_io_executors<void(Head, Tail...)> -{ - explicit composed_io_executors(const Head& head, - const Tail&... tail) BOOST_ASIO_NOEXCEPT - : head_(head), - tail_(tail...) - { - } - - void reset() - { - head_.reset(); - tail_.reset(); - } - - typedef Head head_type; - Head head_; - composed_io_executors<void(Tail...)> tail_; -}; - -template <typename Head, typename... Tail> -inline composed_io_executors<void(Head, Tail...)> -make_composed_io_executors(const Head& head, const Tail&... tail) -{ - return composed_io_executors<void(Head, Tail...)>(head, tail...); -} - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#define BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF(n) \ -template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ -struct composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \ -{ \ - explicit composed_io_executors(const Head& head, \ - BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) BOOST_ASIO_NOEXCEPT \ - : head_(head), \ - tail_(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) \ - { \ - } \ -\ - void reset() \ - { \ - head_.reset(); \ - tail_.reset(); \ - } \ -\ - typedef Head head_type; \ - Head head_; \ - composed_io_executors<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \ -}; \ -\ -template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ -inline composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \ -make_composed_io_executors(const Head& head, \ - BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) \ -{ \ - return composed_io_executors< \ - void(Head, BOOST_ASIO_VARIADIC_TARGS(n))>( \ - head, BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)); \ -} \ -/**/ -BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF) -#undef BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename> -struct composed_work; - -template <> -struct composed_work<void()> -{ - typedef composed_io_executors<void()> executors_type; - - composed_work(const executors_type&) BOOST_ASIO_NOEXCEPT - : head_(system_executor()) - { - } - - void reset() - { - head_.reset(); - } - - typedef system_executor head_type; - composed_work_guard<system_executor> head_; -}; - -template <typename Head> -struct composed_work<void(Head)> -{ - typedef composed_io_executors<void(Head)> executors_type; - - explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT - : head_(ex.head_) - { - } - - void reset() - { - head_.reset(); - } - - typedef Head head_type; - composed_work_guard<Head> head_; -}; - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename Head, typename... Tail> -struct composed_work<void(Head, Tail...)> -{ - typedef composed_io_executors<void(Head, Tail...)> executors_type; - - explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT - : head_(ex.head_), - tail_(ex.tail_) - { - } - - void reset() - { - head_.reset(); - tail_.reset(); - } - - typedef Head head_type; - composed_work_guard<Head> head_; - composed_work<void(Tail...)> tail_; -}; - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#define BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF(n) \ -template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ -struct composed_work<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \ -{ \ - typedef composed_io_executors<void(Head, \ - BOOST_ASIO_VARIADIC_TARGS(n))> executors_type; \ -\ - explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT \ - : head_(ex.head_), \ - tail_(ex.tail_) \ - { \ - } \ -\ - void reset() \ - { \ - head_.reset(); \ - tail_.reset(); \ - } \ -\ - typedef Head head_type; \ - composed_work_guard<Head> head_; \ - composed_work<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \ -}; \ -/**/ -BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF) -#undef BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - #if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) template <typename Impl, typename Work, typename Handler, typename Signature> class composed_op; @@ -344,11 +72,16 @@ public: } #endif // defined(BOOST_ASIO_HAS_MOVE) - typedef typename associated_executor<Handler, - typename composed_work_guard< - typename Work::head_type - >::executor_type - >::type executor_type; + typedef typename composed_work_guard< + typename Work::head_type>::executor_type io_executor_type; + + io_executor_type get_io_executor() const BOOST_ASIO_NOEXCEPT + { + return work_.head_.get_executor(); + } + + typedef typename associated_executor<Handler, io_executor_type>::type + executor_type; executor_type get_executor() const BOOST_ASIO_NOEXCEPT { @@ -441,6 +174,11 @@ public: BOOST_ASIO_MOVE_CAST(OutFilter)(out_filter)); } + cancellation_type_t cancelled() const BOOST_ASIO_NOEXCEPT + { + return base_from_cancellation_state<Handler>::cancelled(); + } + //private: Impl impl_; Work work_; @@ -549,29 +287,6 @@ inline initiate_composed_op<Signature, Executors> make_initiate_composed_op( BOOST_ASIO_MOVE_CAST(composed_io_executors<Executors>)(executors)); } -template <typename IoObject> -inline typename IoObject::executor_type -get_composed_io_executor(IoObject& io_object, - typename enable_if< - !is_executor<IoObject>::value - >::type* = 0, - typename enable_if< - !execution::is_executor<IoObject>::value - >::type* = 0) -{ - return io_object.get_executor(); -} - -template <typename Executor> -inline const Executor& get_composed_io_executor(const Executor& ex, - typename enable_if< - is_executor<Executor>::value - || execution::is_executor<Executor>::value - >::type* = 0) -{ - return ex; -} - } // namespace detail #if !defined(GENERATING_DOCUMENTATION) @@ -584,9 +299,19 @@ struct associator<Associator, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::composed_op<Impl, Work, Handler, Signature>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::composed_op<Impl, Work, Handler, Signature>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::composed_op<Impl, Work, Handler, Signature>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } @@ -609,7 +334,7 @@ struct associator<Associator, * handler. The remaining arguments are any arguments that originate from the * completion handlers of any asynchronous operations performed by the * implementation. - + * * @param token The completion token. * * @param io_objects_or_executors Zero or more I/O objects or I/O executors for diff --git a/contrib/restricted/boost/asio/include/boost/asio/consign.hpp b/contrib/restricted/boost/asio/include/boost/asio/consign.hpp new file mode 100644 index 0000000000..39b4741b27 --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/consign.hpp @@ -0,0 +1,90 @@ +// +// consign.hpp +// ~~~~~~~~~~ +// +// 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) +// + +#ifndef BOOST_ASIO_CONSIGN_HPP +#define BOOST_ASIO_CONSIGN_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if (defined(BOOST_ASIO_HAS_STD_TUPLE) \ + && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) \ + || defined(GENERATING_DOCUMENTATION) + +#include <tuple> +#include <boost/asio/detail/type_traits.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Completion token type used to specify that the completion handler should +/// carry additional values along with it. +/** + * This completion token adapter is typically used to keep at least one copy of + * an object, such as a smart pointer, alive until the completion handler is + * called. + */ +template <typename CompletionToken, typename... Values> +class consign_t +{ +public: + /// Constructor. + template <typename T, typename... V> + BOOST_ASIO_CONSTEXPR explicit consign_t( + BOOST_ASIO_MOVE_ARG(T) completion_token, + BOOST_ASIO_MOVE_ARG(V)... values) + : token_(BOOST_ASIO_MOVE_CAST(T)(completion_token)), + values_(BOOST_ASIO_MOVE_CAST(V)(values)...) + { + } + +#if defined(GENERATING_DOCUMENTATION) +private: +#endif // defined(GENERATING_DOCUMENTATION) + CompletionToken token_; + std::tuple<Values...> values_; +}; + +/// Completion token adapter used to specify that the completion handler should +/// carry additional values along with it. +/** + * This completion token adapter is typically used to keep at least one copy of + * an object, such as a smart pointer, alive until the completion handler is + * called. + */ +template <typename CompletionToken, typename... Values> +BOOST_ASIO_NODISCARD inline BOOST_ASIO_CONSTEXPR consign_t< + typename decay<CompletionToken>::type, typename decay<Values>::type...> +consign(BOOST_ASIO_MOVE_ARG(CompletionToken) completion_token, + BOOST_ASIO_MOVE_ARG(Values)... values) +{ + return consign_t< + typename decay<CompletionToken>::type, typename decay<Values>::type...>( + BOOST_ASIO_MOVE_CAST(CompletionToken)(completion_token), + BOOST_ASIO_MOVE_CAST(Values)(values)...); +} + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#include <boost/asio/impl/consign.hpp> + +#endif // (defined(BOOST_ASIO_HAS_STD_TUPLE) + // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_CONSIGN_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/defer.hpp b/contrib/restricted/boost/asio/include/boost/asio/defer.hpp index dd3f500a2e..5026ec542c 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/defer.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/defer.hpp @@ -19,8 +19,10 @@ #include <boost/asio/async_result.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution_context.hpp> +#include <boost/asio/execution/blocking.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/is_executor.hpp> +#include <boost/asio/require.hpp> #include <boost/asio/detail/push_options.hpp> @@ -68,12 +70,11 @@ template <typename> class initiate_defer_with_executor; * @code auto alloc = get_associated_allocator(handler); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs - * @code execution::execute( - * prefer( - * require(ex, execution::blocking.never), - * execution::relationship.continuation, - * execution::allocator(alloc)), - * std::forward<CompletionHandler>(completion_handler)); @endcode + * @code prefer( + * require(ex, execution::blocking.never), + * execution::relationship.continuation, + * execution::allocator(alloc) + * ).execute(std::forward<CompletionHandler>(completion_handler)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs * @code ex.defer( @@ -137,11 +138,8 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) defer( * handler_ that is a decay-copy of @c completion_handler, and a function call * operator that performs: * @code auto a = get_associated_allocator(handler_); - * execution::execute( - * prefer(executor_, - * execution::blocking.possibly, - * execution::allocator(a)), - * std::move(handler_)); @endcode + * prefer(executor_, execution::allocator(a)).execute(std::move(handler_)); + * @endcode * * @li If <tt>execution::is_executor<Ex1>::value</tt> is false, constructs a * function object @c f with a member @c work_ that is initialised with @@ -152,12 +150,11 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) defer( * work_.reset(); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs - * @code execution::execute( - * prefer( - * require(ex, execution::blocking.never), - * execution::relationship.continuation, - * execution::allocator(alloc)), - * std::move(f)); @endcode + * @code prefer( + * require(ex, execution::blocking.never), + * execution::relationship.continuation, + * execution::allocator(alloc) + * ).execute(std::move(f)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs * @code ex.defer(std::move(f), alloc); @endcode @@ -173,7 +170,9 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) defer( BOOST_ASIO_MOVE_ARG(NullaryToken) token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(Executor), typename constraint< - execution::is_executor<Executor>::value || is_executor<Executor>::value + (execution::is_executor<Executor>::value + && can_require<Executor, execution::blocking_t::never_t>::value) + || is_executor<Executor>::value >::type = 0) BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( async_initiate<NullaryToken, void()>( diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/bind_handler.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/bind_handler.hpp index 3cdb0830a8..d2eaab0a58 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/bind_handler.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/bind_handler.hpp @@ -950,9 +950,18 @@ struct associator<Associator, detail::binder0<Handler>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::binder0<Handler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::binder0<Handler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::binder0<Handler>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } @@ -964,9 +973,18 @@ struct associator<Associator, detail::binder1<Handler, Arg1>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::binder1<Handler, Arg1>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::binder1<Handler, Arg1>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::binder1<Handler, Arg1>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } @@ -979,9 +997,18 @@ struct associator<Associator, detail::binder2<Handler, Arg1, Arg2>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::binder2<Handler, Arg1, Arg2>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::binder2<Handler, Arg1, Arg2>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::binder2<Handler, Arg1, Arg2>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } @@ -994,9 +1021,18 @@ struct associator<Associator, detail::binder3<Handler, Arg1, Arg2, Arg3>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::binder3<Handler, Arg1, Arg2, Arg3>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::binder3<Handler, Arg1, Arg2, Arg3>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::binder3<Handler, Arg1, Arg2, Arg3>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } @@ -1009,9 +1045,19 @@ struct associator<Associator, detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } @@ -1024,9 +1070,19 @@ struct associator<Associator, detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } @@ -1040,9 +1096,18 @@ struct associator<Associator, detail::move_binder1<Handler, Arg1>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::move_binder1<Handler, Arg1>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::move_binder1<Handler, Arg1>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::move_binder1<Handler, Arg1>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } @@ -1055,9 +1120,18 @@ struct associator<Associator, detail::move_binder2<Handler, Arg1, Arg2>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::move_binder2<Handler, Arg1, Arg2>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::move_binder2<Handler, Arg1, Arg2>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::move_binder2<Handler, Arg1, Arg2>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/composed_work.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/composed_work.hpp new file mode 100644 index 0000000000..522673136d --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/composed_work.hpp @@ -0,0 +1,330 @@ +// +// detail/composed_work.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// +// 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) +// + +#ifndef BOOST_ASIO_DETAIL_COMPOSED_WORK_HPP +#define BOOST_ASIO_DETAIL_COMPOSED_WORK_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/type_traits.hpp> +#include <boost/asio/detail/variadic_templates.hpp> +#include <boost/asio/execution/executor.hpp> +#include <boost/asio/execution/outstanding_work.hpp> +#include <boost/asio/executor_work_guard.hpp> +#include <boost/asio/is_executor.hpp> +#include <boost/asio/system_executor.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename Executor, typename = void> +class composed_work_guard +{ +public: + typedef typename decay< + typename prefer_result<Executor, + execution::outstanding_work_t::tracked_t + >::type + >::type executor_type; + + composed_work_guard(const Executor& ex) + : executor_(boost::asio::prefer(ex, execution::outstanding_work.tracked)) + { + } + + void reset() + { + } + + executor_type get_executor() const BOOST_ASIO_NOEXCEPT + { + return executor_; + } + +private: + executor_type executor_; +}; + +template <> +struct composed_work_guard<system_executor> +{ +public: + typedef system_executor executor_type; + + composed_work_guard(const system_executor&) + { + } + + void reset() + { + } + + executor_type get_executor() const BOOST_ASIO_NOEXCEPT + { + return system_executor(); + } +}; + +#if !defined(BOOST_ASIO_NO_TS_EXECUTORS) + +template <typename Executor> +struct composed_work_guard<Executor, + typename enable_if< + !execution::is_executor<Executor>::value + >::type> : executor_work_guard<Executor> +{ + composed_work_guard(const Executor& ex) + : executor_work_guard<Executor>(ex) + { + } +}; + +#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) + +template <typename> +struct composed_io_executors; + +template <> +struct composed_io_executors<void()> +{ + composed_io_executors() BOOST_ASIO_NOEXCEPT + : head_(system_executor()) + { + } + + typedef system_executor head_type; + system_executor head_; +}; + +inline composed_io_executors<void()> make_composed_io_executors() +{ + return composed_io_executors<void()>(); +} + +template <typename Head> +struct composed_io_executors<void(Head)> +{ + explicit composed_io_executors(const Head& ex) BOOST_ASIO_NOEXCEPT + : head_(ex) + { + } + + typedef Head head_type; + Head head_; +}; + +template <typename Head> +inline composed_io_executors<void(Head)> +make_composed_io_executors(const Head& head) +{ + return composed_io_executors<void(Head)>(head); +} + +#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +template <typename Head, typename... Tail> +struct composed_io_executors<void(Head, Tail...)> +{ + explicit composed_io_executors(const Head& head, + const Tail&... tail) BOOST_ASIO_NOEXCEPT + : head_(head), + tail_(tail...) + { + } + + void reset() + { + head_.reset(); + tail_.reset(); + } + + typedef Head head_type; + Head head_; + composed_io_executors<void(Tail...)> tail_; +}; + +template <typename Head, typename... Tail> +inline composed_io_executors<void(Head, Tail...)> +make_composed_io_executors(const Head& head, const Tail&... tail) +{ + return composed_io_executors<void(Head, Tail...)>(head, tail...); +} + +#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +#define BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF(n) \ +template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ +struct composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \ +{ \ + explicit composed_io_executors(const Head& head, \ + BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) BOOST_ASIO_NOEXCEPT \ + : head_(head), \ + tail_(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) \ + { \ + } \ +\ + void reset() \ + { \ + head_.reset(); \ + tail_.reset(); \ + } \ +\ + typedef Head head_type; \ + Head head_; \ + composed_io_executors<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \ +}; \ +\ +template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ +inline composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \ +make_composed_io_executors(const Head& head, \ + BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) \ +{ \ + return composed_io_executors< \ + void(Head, BOOST_ASIO_VARIADIC_TARGS(n))>( \ + head, BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)); \ +} \ +/**/ +BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF) +#undef BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF + +#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +template <typename> +struct composed_work; + +template <> +struct composed_work<void()> +{ + typedef composed_io_executors<void()> executors_type; + + composed_work(const executors_type&) BOOST_ASIO_NOEXCEPT + : head_(system_executor()) + { + } + + void reset() + { + head_.reset(); + } + + typedef system_executor head_type; + composed_work_guard<system_executor> head_; +}; + +template <typename Head> +struct composed_work<void(Head)> +{ + typedef composed_io_executors<void(Head)> executors_type; + + explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT + : head_(ex.head_) + { + } + + void reset() + { + head_.reset(); + } + + typedef Head head_type; + composed_work_guard<Head> head_; +}; + +#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +template <typename Head, typename... Tail> +struct composed_work<void(Head, Tail...)> +{ + typedef composed_io_executors<void(Head, Tail...)> executors_type; + + explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT + : head_(ex.head_), + tail_(ex.tail_) + { + } + + void reset() + { + head_.reset(); + tail_.reset(); + } + + typedef Head head_type; + composed_work_guard<Head> head_; + composed_work<void(Tail...)> tail_; +}; + +#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +#define BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF(n) \ +template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ +struct composed_work<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \ +{ \ + typedef composed_io_executors<void(Head, \ + BOOST_ASIO_VARIADIC_TARGS(n))> executors_type; \ +\ + explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT \ + : head_(ex.head_), \ + tail_(ex.tail_) \ + { \ + } \ +\ + void reset() \ + { \ + head_.reset(); \ + tail_.reset(); \ + } \ +\ + typedef Head head_type; \ + composed_work_guard<Head> head_; \ + composed_work<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \ +}; \ +/**/ +BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF) +#undef BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF + +#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +template <typename IoObject> +inline typename IoObject::executor_type +get_composed_io_executor(IoObject& io_object, + typename enable_if< + !is_executor<IoObject>::value + >::type* = 0, + typename enable_if< + !execution::is_executor<IoObject>::value + >::type* = 0) +{ + return io_object.get_executor(); +} + +template <typename Executor> +inline const Executor& get_composed_io_executor(const Executor& ex, + typename enable_if< + is_executor<Executor>::value + || execution::is_executor<Executor>::value + >::type* = 0) +{ + return ex; +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_COMPOSED_WORK_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp index f628c1a945..7d3d75da15 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp @@ -371,6 +371,17 @@ # endif // defined(BOOST_ASIO_MSVC) # endif // !defined(BOOST_ASIO_DISABLE_DECLTYPE) #endif // !defined(BOOST_ASIO_HAS_DECLTYPE) +#if defined(BOOST_ASIO_HAS_DECLTYPE) +# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(t) auto +# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(t0, t1) auto +# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX3(t0, t1, t2) auto +# define BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(expr) -> decltype expr +#else // defined(BOOST_ASIO_HAS_DECLTYPE) +# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(t) t +# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(t0, t1) t0, t1 +# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX3(t0, t1, t2) t0, t1, t2 +# define BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(expr) +#endif // defined(BOOST_ASIO_HAS_DECLTYPE) // Support alias templates on compilers known to allow it. #if !defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) @@ -407,7 +418,11 @@ # if (__cpp_return_type_deduction >= 201304) # define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1 # endif // (__cpp_return_type_deduction >= 201304) -# endif // defined(__cpp_return_type_deduction) +# elif defined(BOOST_ASIO_MSVC) +# if (_MSC_VER >= 1900 && _MSVC_LANG >= 201402) +# define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1 +# endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 201402) +# endif // defined(BOOST_ASIO_MSVC) # endif // !defined(BOOST_ASIO_DISABLE_RETURN_TYPE_DEDUCTION) #endif // !defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION) @@ -675,6 +690,30 @@ # endif // !defined(BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC) #endif // !defined(BOOST_ASIO_HAS_STD_ALIGNED_ALLOC) +// Standard library support for std::align. +#if !defined(BOOST_ASIO_HAS_STD_ALIGN) +# if !defined(BOOST_ASIO_DISABLE_STD_ALIGN) +# if defined(__clang__) +# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX) +# define BOOST_ASIO_HAS_STD_ALIGN 1 +# elif (__cplusplus >= 201103) +# define BOOST_ASIO_HAS_STD_ALIGN 1 +# endif // (__cplusplus >= 201103) +# elif defined(__GNUC__) +# if (__GNUC__ >= 6) +# if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_ALIGN 1 +# endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // (__GNUC__ >= 6) +# endif // defined(__GNUC__) +# if defined(BOOST_ASIO_MSVC) +# if (_MSC_VER >= 1700) +# define BOOST_ASIO_HAS_STD_ALIGN 1 +# endif // (_MSC_VER >= 1700) +# endif // defined(BOOST_ASIO_MSVC) +# endif // !defined(BOOST_ASIO_DISABLE_STD_ALIGN) +#endif // !defined(BOOST_ASIO_HAS_STD_ALIGN) + // Standard library support for system errors. # if !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR) # if defined(__clang__) @@ -1311,14 +1350,11 @@ # if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703) # define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1 # endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703) +# else // defined(BOOST_ASIO_MSVC) +# if (__cplusplus >= 201703) +# define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1 +# endif // (__cplusplus >= 201703) # endif // defined(BOOST_ASIO_MSVC) -# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX) -# if (_LIBCPP_VERSION >= 13000) -# if (__cplusplus >= 201703) -# define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1 -# endif // (__cplusplus >= 201703) -# endif // (_LIBCPP_VERSION >= 13000) -# endif // defined(BOOST_ASIO_HAS_CLANG_LIBCXX) # endif // !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT) #endif // !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT) @@ -2059,7 +2095,11 @@ # if __has_include(<coroutine>) # define BOOST_ASIO_HAS_CO_AWAIT 1 # endif // __has_include(<coroutine>) -# endif // (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902) +# elif (__cplusplus >= 201703) && (__cpp_coroutines >= 201703) +# if __has_include(<experimental/coroutine>) +# define BOOST_ASIO_HAS_CO_AWAIT 1 +# endif // __has_include(<experimental/coroutine>) +# endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703) # else // (__clang_major__ >= 14) # if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703) # if __has_include(<experimental/coroutine>) @@ -2176,7 +2216,11 @@ // Standard library support for snprintf. #if !defined(BOOST_ASIO_HAS_SNPRINTF) # if !defined(BOOST_ASIO_DISABLE_SNPRINTF) +# if defined(__APPLE__) +# if (__clang_major__ >= 14) # define BOOST_ASIO_HAS_SNPRINTF 1 +# endif // (__clang_major__ >= 14) +# endif // defined(__apple_build_version__) # endif // !defined(BOOST_ASIO_DISABLE_SNPRINTF) #endif // !defined(BOOST_ASIO_HAS_SNPRINTF) diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/handler_alloc_helpers.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_alloc_helpers.hpp index 5d127b70fa..d8b116f212 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/handler_alloc_helpers.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_alloc_helpers.hpp @@ -55,7 +55,7 @@ inline void* allocate(std::size_t s, Handler& h, std::size_t align = BOOST_ASIO_DEFAULT_ALIGN) { #if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS) - return aligned_new(align, s); + return boost::asio::aligned_new(align, s); #elif defined(BOOST_ASIO_NO_DEPRECATED) // The asio_handler_allocate hook is no longer used to obtain memory. (void)&error_if_hooks_are_defined<Handler>; @@ -65,7 +65,7 @@ inline void* allocate(std::size_t s, Handler& h, boost::asio::detail::thread_context::top_of_thread_call_stack(), s, align); # else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) - return aligned_new(align, s); + return boost::asio::aligned_new(align, s); # endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) #else (void)align; @@ -78,7 +78,7 @@ template <typename Handler> inline void deallocate(void* p, std::size_t s, Handler& h) { #if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS) - aligned_delete(p); + boost::asio::aligned_delete(p); #elif defined(BOOST_ASIO_NO_DEPRECATED) // The asio_handler_allocate hook is no longer used to obtain memory. (void)&error_if_hooks_are_defined<Handler>; @@ -88,7 +88,7 @@ inline void deallocate(void* p, std::size_t s, Handler& h) boost::asio::detail::thread_context::top_of_thread_call_stack(), p, s); #else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) (void)s; - aligned_delete(p); + boost::asio::aligned_delete(p); #endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) #else using boost::asio::asio_handler_deallocate; diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/handler_work.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_work.hpp index f547d66f72..c0fcd25e75 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/handler_work.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/handler_work.hpp @@ -37,6 +37,7 @@ class io_context; #if !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) +class any_completion_executor; class any_io_executor; #endif // !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) @@ -95,11 +96,16 @@ public: template <typename Function, typename Handler> void dispatch(Function& function, Handler& handler) { +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer(executor_, + execution::allocator((get_associated_allocator)(handler)) + ).execute(BOOST_ASIO_MOVE_CAST(Function)(function)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::prefer(executor_, - execution::blocking.possibly, execution::allocator((get_associated_allocator)(handler))), BOOST_ASIO_MOVE_CAST(Function)(function)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } private: @@ -361,9 +367,11 @@ public: template <typename Function, typename Handler> void dispatch(Function& function, Handler&) { - execution::execute( - boost::asio::prefer(executor_, execution::blocking.possibly), - BOOST_ASIO_MOVE_CAST(Function)(function)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + executor_.execute(BOOST_ASIO_MOVE_CAST(Function)(function)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) + execution::execute(executor_, BOOST_ASIO_MOVE_CAST(Function)(function)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } private: @@ -378,10 +386,8 @@ class handler_work_base< Executor, CandidateExecutor, IoContext, PolymorphicExecutor, typename enable_if< - is_same< - Executor, - any_io_executor - >::value + is_same<Executor, any_completion_executor>::value + || is_same<Executor, any_io_executor>::value >::type> { public: @@ -436,9 +442,11 @@ public: template <typename Function, typename Handler> void dispatch(Function& function, Handler&) { - execution::execute( - boost::asio::prefer(executor_, execution::blocking.possibly), - BOOST_ASIO_MOVE_CAST(Function)(function)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + executor_.execute(BOOST_ASIO_MOVE_CAST(Function)(function)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) + execution::execute(executor_, BOOST_ASIO_MOVE_CAST(Function)(function)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } private: diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/descriptor_ops.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/descriptor_ops.ipp index 4f477c9ea7..ea7705fd08 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/descriptor_ops.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/descriptor_ops.ipp @@ -70,7 +70,18 @@ int close(int d, state_type& state, boost::system::error_code& ec) ::fcntl(d, F_SETFL, flags & ~O_NONBLOCK); #else // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) ioctl_arg_type arg = 0; +# if defined(ENOTTY) + result = ::ioctl(d, FIONBIO, &arg); + get_last_error(ec, result < 0); + if (ec.value() == ENOTTY) + { + int flags = ::fcntl(d, F_GETFL, 0); + if (flags >= 0) + ::fcntl(d, F_SETFL, flags & ~O_NONBLOCK); + } +# else // defined(ENOTTY) ::ioctl(d, FIONBIO, &arg); +# endif // defined(ENOTTY) #endif // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) state &= ~non_blocking; @@ -104,6 +115,19 @@ bool set_user_non_blocking(int d, state_type& state, ioctl_arg_type arg = (value ? 1 : 0); int result = ::ioctl(d, FIONBIO, &arg); get_last_error(ec, result < 0); +# if defined(ENOTTY) + if (ec.value() == ENOTTY) + { + int result = ::fcntl(d, F_GETFL, 0); + get_last_error(ec, result < 0); + if (result >= 0) + { + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = ::fcntl(d, F_SETFL, flag); + get_last_error(ec, result < 0); + } + } +# endif // defined(ENOTTY) #endif // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) if (result >= 0) @@ -154,6 +178,19 @@ bool set_internal_non_blocking(int d, state_type& state, ioctl_arg_type arg = (value ? 1 : 0); int result = ::ioctl(d, FIONBIO, &arg); get_last_error(ec, result < 0); +# if defined(ENOTTY) + if (ec.value() == ENOTTY) + { + int result = ::fcntl(d, F_GETFL, 0); + get_last_error(ec, result < 0); + if (result >= 0) + { + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = ::fcntl(d, F_SETFL, flag); + get_last_error(ec, result < 0); + } + } +# endif // defined(ENOTTY) #endif // defined(__SYMBIAN32__) || defined(__EMSCRIPTEN__) if (result >= 0) diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/select_reactor.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/select_reactor.ipp index dce53bd57e..f8f9f54545 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/select_reactor.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/select_reactor.ipp @@ -310,7 +310,7 @@ void select_reactor::run_thread() { lock.unlock(); op_queue<operation> ops; - run(true, ops); + run(-1, ops); scheduler_.post_deferred_completions(ops); lock.lock(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/strand_executor_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/strand_executor_service.hpp index 3c722763b5..d0a7b820d4 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/strand_executor_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/strand_executor_service.hpp @@ -107,13 +107,22 @@ public: { recycling_allocator<void> allocator; executor_type ex = this_->executor_; +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer( + boost::asio::require( + BOOST_ASIO_MOVE_CAST(executor_type)(ex), + execution::blocking.never), + execution::allocator(allocator) + ).execute(BOOST_ASIO_MOVE_CAST(invoker)(*this_)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::prefer( boost::asio::require( BOOST_ASIO_MOVE_CAST(executor_type)(ex), execution::blocking.never), - execution::allocator(allocator)), + execution::allocator(allocator)), BOOST_ASIO_MOVE_CAST(invoker)(*this_)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } } }; @@ -255,7 +264,11 @@ void strand_executor_service::do_execute(const implementation_type& impl, p.v = p.p = 0; if (first) { +#if defined(BOOST_ASIO_NO_DEPRECATED) + ex.execute(invoker<Executor>(impl, ex)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute(ex, invoker<Executor>(impl, ex)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } } diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_handle_service.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_handle_service.ipp index 1a4b57801e..33c61def0e 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_handle_service.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/win_iocp_handle_service.ipp @@ -69,6 +69,7 @@ public: win_iocp_handle_service::win_iocp_handle_service(execution_context& context) : execution_context_service_base<win_iocp_handle_service>(context), iocp_service_(boost::asio::use_service<win_iocp_io_context>(context)), + nt_set_info_(0), mutex_(), impl_list_(0) { diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/memory.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/memory.hpp index c6d7fd5020..e8828e2c7b 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/memory.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/memory.hpp @@ -20,6 +20,7 @@ #include <cstdlib> #include <memory> #include <new> +#include <boost/asio/detail/cstdint.hpp> #include <boost/asio/detail/throw_exception.hpp> #if !defined(BOOST_ASIO_HAS_STD_SHARED_PTR) @@ -73,6 +74,23 @@ template <typename T> inline const volatile T* to_address(const volatile T* p) { return p; } #endif // defined(BOOST_ASIO_HAS_STD_TO_ADDRESS) +inline void* align(std::size_t alignment, + std::size_t size, void*& ptr, std::size_t& space) +{ +#if defined(BOOST_ASIO_HAS_STD_ALIGN) + return std::align(alignment, size, ptr, space); +#else // defined(BOOST_ASIO_HAS_STD_ALIGN) + const uintptr_t intptr = reinterpret_cast<uintptr_t>(ptr); + const uintptr_t aligned = (intptr - 1u + alignment) & -alignment; + const std::size_t padding = aligned - intptr; + if (size + padding > space) + return 0; + space -= padding; + ptr = reinterpret_cast<void*>(aligned); + return ptr; +#endif // defined(BOOST_ASIO_HAS_STD_ALIGN) +} + } // namespace detail #if defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS) diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/utility.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/utility.hpp index e71c8cf4fb..c1dc73c8e9 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/utility.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/utility.hpp @@ -16,8 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> - -# include <utility> +#include <utility> namespace boost { namespace asio { diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/work_dispatcher.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/work_dispatcher.hpp index 0b364cae34..6d2413a3e9 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/detail/work_dispatcher.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/detail/work_dispatcher.hpp @@ -81,12 +81,16 @@ public: { typename associated_allocator<Handler>::type alloc( (get_associated_allocator)(handler_)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer(executor_, execution::allocator(alloc)).execute( + boost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(Handler)(handler_))); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( - boost::asio::prefer(executor_, - execution::blocking.possibly, - execution::allocator(alloc)), + boost::asio::prefer(executor_, execution::allocator(alloc)), boost::asio::detail::bind_handler( BOOST_ASIO_MOVE_CAST(Handler)(handler_))); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } private: diff --git a/contrib/restricted/boost/asio/include/boost/asio/dispatch.hpp b/contrib/restricted/boost/asio/include/boost/asio/dispatch.hpp index bc326f420a..dd4de50172 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/dispatch.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/dispatch.hpp @@ -63,10 +63,7 @@ template <typename> class initiate_dispatch_with_executor; * @code auto alloc = get_associated_allocator(handler); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs - * @code execution::execute( - * prefer(ex, - * execution::blocking.possibly, - * execution::allocator(alloc)), + * @code prefer(ex, execution::allocator(alloc)).execute( * std::forward<CompletionHandler>(completion_handler)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs @@ -126,11 +123,8 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) dispatch( * handler_ that is a decay-copy of @c completion_handler, and a function call * operator that performs: * @code auto a = get_associated_allocator(handler_); - * execution::execute( - * prefer(executor_, - * execution::blocking.possibly, - * execution::allocator(a)), - * std::move(handler_)); @endcode + * prefer(executor_, execution::allocator(a)).execute(std::move(handler_)); + * @endcode * * @li If <tt>execution::is_executor<Ex1>::value</tt> is false, constructs a * function object @c f with a member @c work_ that is initialised with @@ -141,11 +135,7 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) dispatch( * work_.reset(); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs - * @code execution::execute( - * prefer(ex, - * execution::blocking.possibly, - * execution::allocator(alloc)), - * std::move(f)); @endcode + * @code prefer(ex, execution::allocator(alloc)).execute(std::move(f)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs * @code ex.dispatch(std::move(f), alloc); @endcode diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/allocator.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/allocator.hpp index 47f2f434d9..af3f197f75 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/allocator.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/allocator.hpp @@ -79,6 +79,12 @@ template <typename ProtoAllocator> struct allocator_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -92,7 +98,9 @@ struct allocator_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -173,6 +181,12 @@ template <> struct allocator_t<void> { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -186,7 +200,9 @@ struct allocator_t<void> is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -284,6 +300,7 @@ template <typename T, typename ProtoAllocator> struct is_applicable_property<T, execution::allocator_t<ProtoAllocator> > : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -293,7 +310,9 @@ struct is_applicable_property<T, execution::allocator_t<ProtoAllocator> > execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/any_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/any_executor.hpp index 1a066d2478..3a05141604 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/any_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/any_executor.hpp @@ -19,6 +19,7 @@ #include <new> #include <typeinfo> #include <boost/asio/detail/assert.hpp> +#include <boost/asio/detail/atomic_count.hpp> #include <boost/asio/detail/cstddef.hpp> #include <boost/asio/detail/executor_function.hpp> #include <boost/asio/detail/memory.hpp> @@ -65,10 +66,25 @@ public: template <class... OtherSupportableProperties> any_executor(any_executor<OtherSupportableProperties...> e); + /// Construct to point to the same target as another any_executor. + template <class... OtherSupportableProperties> + any_executor(std::nothrow_t, + any_executor<OtherSupportableProperties...> e) noexcept; + + /// Construct to point to the same target as another any_executor. + any_executor(std::nothrow_t, const any_executor& e) noexcept; + + /// Construct to point to the same target as another any_executor. + any_executor(std::nothrow_t, any_executor&& e) noexcept; + /// Construct a polymorphic wrapper for the specified executor. template <typename Executor> any_executor(Executor e); + /// Construct a polymorphic wrapper for the specified executor. + template <typename Executor> + any_executor(std::nothrow_t, Executor e) noexcept; + /// Assignment operator. any_executor& operator=(const any_executor& e) noexcept; @@ -127,13 +143,6 @@ public: /// Execute the function on the target executor. /** - * Do not call this function directly. It is intended for use with the - * execution::execute customisation point. - * - * For example: - * @code execution::any_executor<> ex = ...; - * execution::execute(ex, my_function_object); @endcode - * * Throws boost::asio::bad_executor if the polymorphic wrapper has no target. */ template <typename Function> @@ -487,13 +496,103 @@ struct is_valid_target_executor<int, Props> : false_type { }; +class shared_target_executor +{ +public: + template <typename E> + shared_target_executor(BOOST_ASIO_MOVE_ARG(E) e, + typename decay<E>::type*& target) + { + impl<typename decay<E>::type>* i = + new impl<typename decay<E>::type>(BOOST_ASIO_MOVE_CAST(E)(e)); + target = &i->ex_; + impl_ = i; + } + + template <typename E> + shared_target_executor(std::nothrow_t, BOOST_ASIO_MOVE_ARG(E) e, + typename decay<E>::type*& target) BOOST_ASIO_NOEXCEPT + { + impl<typename decay<E>::type>* i = + new (std::nothrow) impl<typename decay<E>::type>( + BOOST_ASIO_MOVE_CAST(E)(e)); + target = i ? &i->ex_ : 0; + impl_ = i; + } + + shared_target_executor( + const shared_target_executor& other) BOOST_ASIO_NOEXCEPT + : impl_(other.impl_) + { + if (impl_) + boost::asio::detail::ref_count_up(impl_->ref_count_); + } + + shared_target_executor& operator=( + const shared_target_executor& other) BOOST_ASIO_NOEXCEPT + { + impl_ = other.impl_; + if (impl_) + boost::asio::detail::ref_count_up(impl_->ref_count_); + return *this; + } + +#if defined(BOOST_ASIO_HAS_MOVE) + shared_target_executor( + shared_target_executor&& other) BOOST_ASIO_NOEXCEPT + : impl_(other.impl_) + { + other.impl_ = 0; + } + + shared_target_executor& operator=( + shared_target_executor&& other) BOOST_ASIO_NOEXCEPT + { + impl_ = other.impl_; + other.impl_ = 0; + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + ~shared_target_executor() + { + if (impl_) + if (boost::asio::detail::ref_count_down(impl_->ref_count_)) + delete impl_; + } + + void* get() const BOOST_ASIO_NOEXCEPT + { + return impl_ ? impl_->get() : 0; + } + +private: + struct impl_base + { + impl_base() : ref_count_(1) {} + virtual ~impl_base() {} + virtual void* get() = 0; + boost::asio::detail::atomic_count ref_count_; + }; + + template <typename Executor> + struct impl : impl_base + { + impl(Executor ex) : ex_(BOOST_ASIO_MOVE_CAST(Executor)(ex)) {} + virtual void* get() { return &ex_; } + Executor ex_; + }; + + impl_base* impl_; +}; + class any_executor_base { public: any_executor_base() BOOST_ASIO_NOEXCEPT - : object_fns_(object_fns_table<void>()), + : object_fns_(0), target_(0), - target_fns_(target_fns_table<void>()) + target_fns_(0) { } @@ -512,28 +611,74 @@ public: } template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> + any_executor_base(std::nothrow_t, Executor ex, false_type) BOOST_ASIO_NOEXCEPT + : target_fns_(target_fns_table<Executor>( + any_executor_base::query_blocking(ex, + can_query<const Executor&, const execution::blocking_t&>()) + == execution::blocking.always)) + { + any_executor_base::construct_object(std::nothrow, ex, + integral_constant<bool, + sizeof(Executor) <= sizeof(object_type) + && alignment_of<Executor>::value <= alignment_of<object_type>::value + >()); + if (target_ == 0) + { + object_fns_ = 0; + target_fns_ = 0; + } + } + + template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> any_executor_base(Executor other, true_type) - : object_fns_(object_fns_table<boost::asio::detail::shared_ptr<void> >()), + : object_fns_(object_fns_table<shared_target_executor>()), target_fns_(other.target_fns_) { - boost::asio::detail::shared_ptr<Executor> p = - boost::asio::detail::make_shared<Executor>( - BOOST_ASIO_MOVE_CAST(Executor)(other)); + Executor* p = 0; + new (&object_) shared_target_executor( + BOOST_ASIO_MOVE_CAST(Executor)(other), p); target_ = p->template target<void>(); - new (&object_) boost::asio::detail::shared_ptr<void>( - BOOST_ASIO_MOVE_CAST(boost::asio::detail::shared_ptr<Executor>)(p)); } - any_executor_base(const any_executor_base& other) BOOST_ASIO_NOEXCEPT - : object_fns_(other.object_fns_), + template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> + any_executor_base(std::nothrow_t, + Executor other, true_type) BOOST_ASIO_NOEXCEPT + : object_fns_(object_fns_table<shared_target_executor>()), target_fns_(other.target_fns_) { - object_fns_->copy(*this, other); + Executor* p = 0; + new (&object_) shared_target_executor( + std::nothrow, BOOST_ASIO_MOVE_CAST(Executor)(other), p); + if (p) + target_ = p->template target<void>(); + else + { + target_ = 0; + object_fns_ = 0; + target_fns_ = 0; + } + } + + any_executor_base(const any_executor_base& other) BOOST_ASIO_NOEXCEPT + { + if (!!other) + { + object_fns_ = other.object_fns_; + target_fns_ = other.target_fns_; + object_fns_->copy(*this, other); + } + else + { + object_fns_ = 0; + target_ = 0; + target_fns_ = 0; + } } ~any_executor_base() BOOST_ASIO_NOEXCEPT { - object_fns_->destroy(*this); + if (!!*this) + object_fns_->destroy(*this); } any_executor_base& operator=( @@ -541,33 +686,53 @@ public: { if (this != &other) { - object_fns_->destroy(*this); - object_fns_ = other.object_fns_; - target_fns_ = other.target_fns_; - object_fns_->copy(*this, other); + if (!!*this) + object_fns_->destroy(*this); + if (!!other) + { + object_fns_ = other.object_fns_; + target_fns_ = other.target_fns_; + object_fns_->copy(*this, other); + } + else + { + object_fns_ = 0; + target_ = 0; + target_fns_ = 0; + } } return *this; } any_executor_base& operator=(nullptr_t) BOOST_ASIO_NOEXCEPT { - object_fns_->destroy(*this); + if (target_) + object_fns_->destroy(*this); target_ = 0; - object_fns_ = object_fns_table<void>(); - target_fns_ = target_fns_table<void>(); + object_fns_ = 0; + target_fns_ = 0; return *this; } #if defined(BOOST_ASIO_HAS_MOVE) any_executor_base(any_executor_base&& other) BOOST_ASIO_NOEXCEPT - : object_fns_(other.object_fns_), - target_fns_(other.target_fns_) { - other.object_fns_ = object_fns_table<void>(); - other.target_fns_ = target_fns_table<void>(); - object_fns_->move(*this, other); - other.target_ = 0; + if (other.target_) + { + object_fns_ = other.object_fns_; + target_fns_ = other.target_fns_; + other.object_fns_ = 0; + other.target_fns_ = 0; + object_fns_->move(*this, other); + other.target_ = 0; + } + else + { + object_fns_ = 0; + target_ = 0; + target_fns_ = 0; + } } any_executor_base& operator=( @@ -575,13 +740,23 @@ public: { if (this != &other) { - object_fns_->destroy(*this); - object_fns_ = other.object_fns_; - other.object_fns_ = object_fns_table<void>(); - target_fns_ = other.target_fns_; - other.target_fns_ = target_fns_table<void>(); - object_fns_->move(*this, other); - other.target_ = 0; + if (!!*this) + object_fns_->destroy(*this); + if (!!other) + { + object_fns_ = other.object_fns_; + target_fns_ = other.target_fns_; + other.object_fns_ = 0; + other.target_fns_ = 0; + object_fns_->move(*this, other); + other.target_ = 0; + } + else + { + object_fns_ = 0; + target_ = 0; + target_fns_ = 0; + } } return *this; } @@ -601,38 +776,53 @@ public: template <typename F> void execute(BOOST_ASIO_MOVE_ARG(F) f) const { - if (target_fns_->blocking_execute != 0) + if (target_) { - boost::asio::detail::non_const_lvalue<F> f2(f); - target_fns_->blocking_execute(*this, function_view(f2.value)); + if (target_fns_->blocking_execute != 0) + { + boost::asio::detail::non_const_lvalue<F> f2(f); + target_fns_->blocking_execute(*this, function_view(f2.value)); + } + else + { + target_fns_->execute(*this, + function(BOOST_ASIO_MOVE_CAST(F)(f), std::allocator<void>())); + } } else { - target_fns_->execute(*this, - function(BOOST_ASIO_MOVE_CAST(F)(f), std::allocator<void>())); + bad_executor ex; + boost::asio::detail::throw_exception(ex); } } template <typename Executor> Executor* target() { - return static_cast<Executor*>(target_); + return target_ && (is_same<Executor, void>::value + || target_fns_->target_type() == target_type_ex<Executor>()) + ? static_cast<Executor*>(target_) : 0; } template <typename Executor> const Executor* target() const { - return static_cast<Executor*>(target_); + return target_ && (is_same<Executor, void>::value + || target_fns_->target_type() == target_type_ex<Executor>()) + ? static_cast<const Executor*>(target_) : 0; } #if !defined(BOOST_ASIO_NO_TYPEID) const std::type_info& target_type() const + { + return target_ ? target_fns_->target_type() : typeid(void); + } #else // !defined(BOOST_ASIO_NO_TYPEID) const void* target_type() const -#endif // !defined(BOOST_ASIO_NO_TYPEID) { - return target_fns_->target_type(); + return target_ ? target_fns_->target_type() : 0; } +#endif // !defined(BOOST_ASIO_NO_TYPEID) struct unspecified_bool_type_t {}; typedef void (*unspecified_bool_type)(unspecified_bool_type_t); @@ -682,57 +872,22 @@ protected: const void* (*target)(const any_executor_base&); }; - static void destroy_void(any_executor_base&) - { - } - - static void copy_void(any_executor_base& ex1, const any_executor_base&) - { - ex1.target_ = 0; - } - - static void move_void(any_executor_base& ex1, any_executor_base&) - { - ex1.target_ = 0; - } - - static const void* target_void(const any_executor_base&) - { - return 0; - } - - template <typename Obj> - static const object_fns* object_fns_table( - typename enable_if< - is_same<Obj, void>::value - >::type* = 0) - { - static const object_fns fns = - { - &any_executor_base::destroy_void, - &any_executor_base::copy_void, - &any_executor_base::move_void, - &any_executor_base::target_void - }; - return &fns; - } - static void destroy_shared(any_executor_base& ex) { - typedef boost::asio::detail::shared_ptr<void> type; + typedef shared_target_executor type; ex.object<type>().~type(); } static void copy_shared(any_executor_base& ex1, const any_executor_base& ex2) { - typedef boost::asio::detail::shared_ptr<void> type; + typedef shared_target_executor type; new (&ex1.object_) type(ex2.object<type>()); ex1.target_ = ex2.target_; } static void move_shared(any_executor_base& ex1, any_executor_base& ex2) { - typedef boost::asio::detail::shared_ptr<void> type; + typedef shared_target_executor type; new (&ex1.object_) type(BOOST_ASIO_MOVE_CAST(type)(ex2.object<type>())); ex1.target_ = ex2.target_; ex2.object<type>().~type(); @@ -740,14 +895,14 @@ protected: static const void* target_shared(const any_executor_base& ex) { - typedef boost::asio::detail::shared_ptr<void> type; + typedef shared_target_executor type; return ex.object<type>().get(); } template <typename Obj> static const object_fns* object_fns_table( typename enable_if< - is_same<Obj, boost::asio::detail::shared_ptr<void> >::value + is_same<Obj, shared_target_executor>::value >::type* = 0) { static const object_fns fns = @@ -791,7 +946,7 @@ protected: static const object_fns* object_fns_table( typename enable_if< !is_same<Obj, void>::value - && !is_same<Obj, boost::asio::detail::shared_ptr<void> >::value + && !is_same<Obj, shared_target_executor>::value >::type* = 0) { static const object_fns fns = @@ -820,52 +975,6 @@ protected: }; #if !defined(BOOST_ASIO_NO_TYPEID) - static const std::type_info& target_type_void() - { - return typeid(void); - } -#else // !defined(BOOST_ASIO_NO_TYPEID) - static const void* target_type_void() - { - return 0; - } -#endif // !defined(BOOST_ASIO_NO_TYPEID) - - static bool equal_void(const any_executor_base&, const any_executor_base&) - { - return true; - } - - static void execute_void(const any_executor_base&, - BOOST_ASIO_MOVE_ARG(function)) - { - bad_executor ex; - boost::asio::detail::throw_exception(ex); - } - - static void blocking_execute_void(const any_executor_base&, function_view) - { - bad_executor ex; - boost::asio::detail::throw_exception(ex); - } - - template <typename Ex> - static const target_fns* target_fns_table( - typename enable_if< - is_same<Ex, void>::value - >::type* = 0) - { - static const target_fns fns = - { - &any_executor_base::target_type_void, - &any_executor_base::equal_void, - &any_executor_base::execute_void, - &any_executor_base::blocking_execute_void - }; - return &fns; - } - -#if !defined(BOOST_ASIO_NO_TYPEID) template <typename Ex> static const std::type_info& target_type_ex() { @@ -891,13 +1000,21 @@ protected: static void execute_ex(const any_executor_base& ex, BOOST_ASIO_MOVE_ARG(function) f) { +#if defined(BOOST_ASIO_NO_DEPRECATED) + ex.target<Ex>()->execute(BOOST_ASIO_MOVE_CAST(function)(f)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute(*ex.target<Ex>(), BOOST_ASIO_MOVE_CAST(function)(f)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename Ex> static void blocking_execute_ex(const any_executor_base& ex, function_view f) { +#if defined(BOOST_ASIO_NO_DEPRECATED) + ex.target<Ex>()->execute(f); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute(*ex.target<Ex>(), f); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename Ex> @@ -1155,13 +1272,30 @@ private: template <typename Executor> void construct_object(Executor& ex, false_type) { - object_fns_ = object_fns_table<boost::asio::detail::shared_ptr<void> >(); - boost::asio::detail::shared_ptr<Executor> p = - boost::asio::detail::make_shared<Executor>( - BOOST_ASIO_MOVE_CAST(Executor)(ex)); - target_ = p.get(); - new (&object_) boost::asio::detail::shared_ptr<void>( - BOOST_ASIO_MOVE_CAST(boost::asio::detail::shared_ptr<Executor>)(p)); + object_fns_ = object_fns_table<shared_target_executor>(); + Executor* p = 0; + new (&object_) shared_target_executor( + BOOST_ASIO_MOVE_CAST(Executor)(ex), p); + target_ = p; + } + + template <typename Executor> + void construct_object(std::nothrow_t, + Executor& ex, true_type) BOOST_ASIO_NOEXCEPT + { + object_fns_ = object_fns_table<Executor>(); + target_ = new (&object_) Executor(BOOST_ASIO_MOVE_CAST(Executor)(ex)); + } + + template <typename Executor> + void construct_object(std::nothrow_t, + Executor& ex, false_type) BOOST_ASIO_NOEXCEPT + { + object_fns_ = object_fns_table<shared_target_executor>(); + Executor* p = 0; + new (&object_) shared_target_executor( + std::nothrow, BOOST_ASIO_MOVE_CAST(Executor)(ex), p); + target_ = p; } /*private:*/public: @@ -1228,6 +1362,21 @@ public: { } + template <typename Executor> + any_executor(std::nothrow_t, Executor ex, + typename enable_if< + conditional< + !is_same<Executor, any_executor>::value + && !is_base_of<detail::any_executor_base, Executor>::value, + is_executor<Executor>, + false_type + >::type::value + >::type* = 0) BOOST_ASIO_NOEXCEPT + : detail::any_executor_base(std::nothrow, + BOOST_ASIO_MOVE_CAST(Executor)(ex), false_type()) + { + } + #if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) template <typename... OtherSupportableProperties> @@ -1237,6 +1386,14 @@ public: { } + template <typename... OtherSupportableProperties> + any_executor(std::nothrow_t, + any_executor<OtherSupportableProperties...> other) BOOST_ASIO_NOEXCEPT + : detail::any_executor_base( + static_cast<const detail::any_executor_base&>(other)) + { + } + #else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) template <typename U0, typename U1, typename U2, typename U3, @@ -1247,6 +1404,15 @@ public: { } + template <typename U0, typename U1, typename U2, typename U3, + typename U4, typename U5, typename U6, typename U7> + any_executor(std::nothrow_t, + any_executor<U0, U1, U2, U3, U4, U5, U6, U7> other) BOOST_ASIO_NOEXCEPT + : detail::any_executor_base( + static_cast<const detail::any_executor_base&>(other)) + { + } + #endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) any_executor(const any_executor& other) BOOST_ASIO_NOEXCEPT @@ -1255,6 +1421,12 @@ public: { } + any_executor(std::nothrow_t, const any_executor& other) BOOST_ASIO_NOEXCEPT + : detail::any_executor_base( + static_cast<const detail::any_executor_base&>(other)) + { + } + any_executor& operator=(const any_executor& other) BOOST_ASIO_NOEXCEPT { if (this != &other) @@ -1280,6 +1452,13 @@ public: { } + any_executor(std::nothrow_t, any_executor&& other) BOOST_ASIO_NOEXCEPT + : detail::any_executor_base( + static_cast<any_executor_base&&>( + static_cast<any_executor_base&>(other))) + { + } + any_executor& operator=(any_executor&& other) BOOST_ASIO_NOEXCEPT { if (this != &other) @@ -1414,6 +1593,25 @@ public: { } + template <typename Executor> + any_executor(std::nothrow_t, Executor ex, + typename enable_if< + conditional< + !is_same<Executor, any_executor>::value + && !is_base_of<detail::any_executor_base, Executor>::value, + detail::is_valid_target_executor< + Executor, void(SupportableProperties...)>, + false_type + >::type::value + >::type* = 0) BOOST_ASIO_NOEXCEPT + : detail::any_executor_base(std::nothrow, + BOOST_ASIO_MOVE_CAST(Executor)(ex), false_type()), + prop_fns_(prop_fns_table<Executor>()) + { + if (this->template target<void>() == 0) + prop_fns_ = prop_fns_table<void>(); + } + template <typename... OtherSupportableProperties> any_executor(any_executor<OtherSupportableProperties...> other, typename enable_if< @@ -1434,6 +1632,29 @@ public: { } + template <typename... OtherSupportableProperties> + any_executor(std::nothrow_t, + any_executor<OtherSupportableProperties...> other, + typename enable_if< + conditional< + !is_same< + any_executor<OtherSupportableProperties...>, + any_executor + >::value, + typename detail::supportable_properties< + 0, void(SupportableProperties...)>::template is_valid_target< + any_executor<OtherSupportableProperties...> >, + false_type + >::type::value + >::type* = 0) BOOST_ASIO_NOEXCEPT + : detail::any_executor_base(std::nothrow, BOOST_ASIO_MOVE_CAST( + any_executor<OtherSupportableProperties...>)(other), true_type()), + prop_fns_(prop_fns_table<any_executor<OtherSupportableProperties...> >()) + { + if (this->template target<void>() == 0) + prop_fns_ = prop_fns_table<void>(); + } + any_executor(const any_executor& other) BOOST_ASIO_NOEXCEPT : detail::any_executor_base( static_cast<const detail::any_executor_base&>(other)), @@ -1441,6 +1662,13 @@ public: { } + any_executor(std::nothrow_t, const any_executor& other) BOOST_ASIO_NOEXCEPT + : detail::any_executor_base( + static_cast<const detail::any_executor_base&>(other)), + prop_fns_(other.prop_fns_) + { + } + any_executor& operator=(const any_executor& other) BOOST_ASIO_NOEXCEPT { if (this != &other) @@ -1470,6 +1698,15 @@ public: other.prop_fns_ = prop_fns_table<void>(); } + any_executor(std::nothrow_t, any_executor&& other) BOOST_ASIO_NOEXCEPT + : detail::any_executor_base( + static_cast<any_executor_base&&>( + static_cast<any_executor_base&>(other))), + prop_fns_(other.prop_fns_) + { + other.prop_fns_ = prop_fns_table<void>(); + } + any_executor& operator=(any_executor&& other) BOOST_ASIO_NOEXCEPT { if (this != &other) @@ -1789,6 +2026,15 @@ inline void swap(any_executor<SupportableProperties...>& a, other.prop_fns_ = prop_fns_table<void>(); \ } \ \ + any_executor(std::nothrow_t, any_executor&& other) BOOST_ASIO_NOEXCEPT \ + : detail::any_executor_base( \ + static_cast<any_executor_base&&>( \ + static_cast<any_executor_base&>(other))), \ + prop_fns_(other.prop_fns_) \ + { \ + other.prop_fns_ = prop_fns_table<void>(); \ + } \ + \ any_executor& operator=(any_executor&& other) BOOST_ASIO_NOEXCEPT \ { \ if (this != &other) \ @@ -1846,6 +2092,25 @@ inline void swap(any_executor<SupportableProperties...>& a, { \ } \ \ + template <BOOST_ASIO_EXECUTION_EXECUTOR Executor> \ + any_executor(std::nothrow_t, Executor ex, \ + typename enable_if< \ + conditional< \ + !is_same<Executor, any_executor>::value \ + && !is_base_of<detail::any_executor_base, Executor>::value, \ + detail::is_valid_target_executor< \ + Executor, void(BOOST_ASIO_VARIADIC_TARGS(n))>, \ + false_type \ + >::type::value \ + >::type* = 0) BOOST_ASIO_NOEXCEPT \ + : detail::any_executor_base(std::nothrow, \ + BOOST_ASIO_MOVE_CAST(Executor)(ex), false_type()), \ + prop_fns_(prop_fns_table<Executor>()) \ + { \ + if (this->template target<void>() == 0) \ + prop_fns_ = prop_fns_table<void>(); \ + } \ + \ any_executor(const any_executor& other) BOOST_ASIO_NOEXCEPT \ : detail::any_executor_base( \ static_cast<const detail::any_executor_base&>(other)), \ @@ -1853,6 +2118,16 @@ inline void swap(any_executor<SupportableProperties...>& a, { \ } \ \ + any_executor(std::nothrow_t, \ + const any_executor& other) BOOST_ASIO_NOEXCEPT \ + : detail::any_executor_base( \ + static_cast<const detail::any_executor_base&>(other)), \ + prop_fns_(other.prop_fns_) \ + { \ + if (this->template target<void>() == 0) \ + prop_fns_ = prop_fns_table<void>(); \ + } \ + \ any_executor(any_executor<> other) \ : detail::any_executor_base(BOOST_ASIO_MOVE_CAST( \ any_executor<>)(other), true_type()), \ @@ -1860,6 +2135,15 @@ inline void swap(any_executor<SupportableProperties...>& a, { \ } \ \ + any_executor(std::nothrow_t, any_executor<> other) BOOST_ASIO_NOEXCEPT \ + : detail::any_executor_base(std::nothrow, \ + BOOST_ASIO_MOVE_CAST(any_executor<>)(other), true_type()), \ + prop_fns_(prop_fns_table<any_executor<> >()) \ + { \ + if (this->template target<void>() == 0) \ + prop_fns_ = prop_fns_table<void>(); \ + } \ + \ template <typename OtherAnyExecutor> \ any_executor(OtherAnyExecutor other, \ typename enable_if< \ @@ -1879,6 +2163,27 @@ inline void swap(any_executor<SupportableProperties...>& a, { \ } \ \ + template <typename OtherAnyExecutor> \ + any_executor(std::nothrow_t, OtherAnyExecutor other, \ + typename enable_if< \ + conditional< \ + !is_same<OtherAnyExecutor, any_executor>::value \ + && is_base_of<detail::any_executor_base, \ + OtherAnyExecutor>::value, \ + typename detail::supportable_properties< \ + 0, void(BOOST_ASIO_VARIADIC_TARGS(n))>::template \ + is_valid_target<OtherAnyExecutor>, \ + false_type \ + >::type::value \ + >::type* = 0) BOOST_ASIO_NOEXCEPT \ + : detail::any_executor_base(std::nothrow, \ + BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(other), true_type()), \ + prop_fns_(prop_fns_table<OtherAnyExecutor>()) \ + { \ + if (this->template target<void>() == 0) \ + prop_fns_ = prop_fns_table<void>(); \ + } \ + \ any_executor& operator=(const any_executor& other) BOOST_ASIO_NOEXCEPT \ { \ if (this != &other) \ diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/blocking.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/blocking.hpp index b4eb733f55..c005bfce5b 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/blocking.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/blocking.hpp @@ -25,6 +25,7 @@ #include <boost/asio/prefer.hpp> #include <boost/asio/query.hpp> #include <boost/asio/require.hpp> +#include <boost/asio/traits/execute_member.hpp> #include <boost/asio/traits/query_free.hpp> #include <boost/asio/traits/query_member.hpp> #include <boost/asio/traits/query_static_constexpr_member.hpp> @@ -209,6 +210,12 @@ template <int I = 0> struct blocking_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -222,7 +229,9 @@ struct blocking_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false); @@ -511,6 +520,12 @@ template <int I = 0> struct possibly_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -524,7 +539,9 @@ struct possibly_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -743,7 +760,11 @@ public: template <typename Function> typename enable_if< +#if defined(BOOST_ASIO_NO_DEPRECATED) + traits::execute_member<const Executor&, Function>::is_valid +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::can_execute<const Executor&, Function>::value +#endif // defined(BOOST_ASIO_NO_DEPRECATED) >::type execute(BOOST_ASIO_MOVE_ARG(Function) f) const { blocking_adaptation::blocking_execute( @@ -768,6 +789,12 @@ template <int I = 0> struct always_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -781,7 +808,9 @@ struct always_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -889,6 +918,12 @@ template <int I> struct never_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -902,7 +937,9 @@ struct never_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -1008,6 +1045,7 @@ template <typename T> struct is_applicable_property<T, execution::blocking_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -1017,7 +1055,9 @@ struct is_applicable_property<T, execution::blocking_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -1025,6 +1065,7 @@ template <typename T> struct is_applicable_property<T, execution::blocking_t::possibly_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -1034,7 +1075,9 @@ struct is_applicable_property<T, execution::blocking_t::possibly_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -1042,6 +1085,7 @@ template <typename T> struct is_applicable_property<T, execution::blocking_t::always_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -1051,7 +1095,9 @@ struct is_applicable_property<T, execution::blocking_t::always_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -1059,6 +1105,7 @@ template <typename T> struct is_applicable_property<T, execution::blocking_t::never_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -1068,7 +1115,9 @@ struct is_applicable_property<T, execution::blocking_t::never_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/blocking_adaptation.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/blocking_adaptation.hpp index 69101a0fb0..08fc2ce6f7 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/blocking_adaptation.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/blocking_adaptation.hpp @@ -165,6 +165,12 @@ template <int I = 0> struct blocking_adaptation_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -178,7 +184,9 @@ struct blocking_adaptation_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false); @@ -417,6 +425,12 @@ template <int I = 0> struct disallowed_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -430,7 +444,9 @@ struct disallowed_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -605,10 +621,18 @@ public: template <typename Function> typename enable_if< +#if defined(BOOST_ASIO_NO_DEPRECATED) + traits::execute_member<const Executor&, Function>::is_valid +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::can_execute<const Executor&, Function>::value +#endif // defined(BOOST_ASIO_NO_DEPRECATED) >::type execute(BOOST_ASIO_MOVE_ARG(Function) f) const { +#if defined(BOOST_ASIO_NO_DEPRECATED) + executor_.execute(BOOST_ASIO_MOVE_CAST(Function)(f)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute(executor_, BOOST_ASIO_MOVE_CAST(Function)(f)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } friend bool operator==(const adapter& a, const adapter& b) BOOST_ASIO_NOEXCEPT @@ -629,6 +653,12 @@ template <int I = 0> struct allowed_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -642,7 +672,9 @@ struct allowed_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -733,7 +765,11 @@ public: void execute_and_wait(BOOST_ASIO_MOVE_ARG(Executor) ex) { handler h = { this }; +#if defined(BOOST_ASIO_NO_DEPRECATED) + ex.execute(h); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute(BOOST_ASIO_MOVE_CAST(Executor)(ex), h); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) boost::asio::detail::mutex::scoped_lock lock(mutex_); while (!is_complete_) event_.wait(lock); @@ -798,6 +834,7 @@ template <typename T> struct is_applicable_property<T, execution::blocking_adaptation_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -807,7 +844,9 @@ struct is_applicable_property<T, execution::blocking_adaptation_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -815,6 +854,7 @@ template <typename T> struct is_applicable_property<T, execution::blocking_adaptation_t::disallowed_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -824,7 +864,9 @@ struct is_applicable_property<T, execution::blocking_adaptation_t::disallowed_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -832,6 +874,7 @@ template <typename T> struct is_applicable_property<T, execution::blocking_adaptation_t::allowed_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -841,7 +884,9 @@ struct is_applicable_property<T, execution::blocking_adaptation_t::allowed_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/bulk_execute.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/bulk_execute.hpp index 4c77558809..c3db343a63 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/bulk_execute.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/bulk_execute.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/bulk_guarantee.hpp> #include <boost/asio/execution/detail/bulk_sender.hpp> @@ -398,4 +401,6 @@ struct bulk_execute_result #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_BULK_EXECUTE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/bulk_guarantee.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/bulk_guarantee.hpp index be2539b7f3..f3dec30aa7 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/bulk_guarantee.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/bulk_guarantee.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/execution/scheduler.hpp> @@ -197,6 +200,12 @@ template <int I = 0> struct bulk_guarantee_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -210,7 +219,9 @@ struct bulk_guarantee_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false); @@ -505,6 +516,12 @@ template <int I = 0> struct unsequenced_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -518,7 +535,9 @@ struct unsequenced_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -633,6 +652,12 @@ template <int I = 0> struct sequenced_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -646,7 +671,9 @@ struct sequenced_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -740,6 +767,12 @@ template <int I> struct parallel_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -753,7 +786,9 @@ struct parallel_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -1214,4 +1249,6 @@ struct static_require<T, execution::bulk_guarantee_t::parallel_t, #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_BULK_GUARANTEE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/connect.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/connect.hpp index 9ee5655a76..d2f88b9495 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/connect.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/connect.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/detail/as_invocable.hpp> #include <boost/asio/execution/detail/as_operation.hpp> @@ -490,4 +493,6 @@ using connect_result_t = typename connect_result<S, R>::type; #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_CONNECT_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/context.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/context.hpp index 5ad3db13ec..36ddd5b86a 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/context.hpp @@ -70,6 +70,12 @@ template <int I = 0> struct context_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -83,7 +89,9 @@ struct context_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false); @@ -180,6 +188,7 @@ template <typename T> struct is_applicable_property<T, execution::context_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -189,7 +198,9 @@ struct is_applicable_property<T, execution::context_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/context_as.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/context_as.hpp index 0de337ba83..6bd4697c7b 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/context_as.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/context_as.hpp @@ -69,6 +69,12 @@ template <typename T> struct context_as_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename U> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<U>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename U> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -82,7 +88,9 @@ struct context_as_t is_executor<U>::value, false_type, is_scheduler<U> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false); @@ -163,6 +171,7 @@ template <typename T, typename U> struct is_applicable_property<T, execution::context_as_t<U> > : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -172,7 +181,9 @@ struct is_applicable_property<T, execution::context_as_t<U> > execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/detail/as_operation.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/detail/as_operation.hpp index 94b1ab1382..fc34306a80 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/detail/as_operation.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/detail/as_operation.hpp @@ -55,8 +55,12 @@ struct as_operation try { #endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) +#if defined(BOOST_ASIO_NO_DEPRECATED) + ex_.execute( +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( BOOST_ASIO_MOVE_CAST(typename remove_cvref<Executor>::type)(ex_), +#endif // defined(BOOST_ASIO_NO_DEPRECATED) as_invocable<typename remove_cvref<Receiver>::type, Executor>(receiver_ #if !defined(BOOST_ASIO_HAS_MOVE) diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/execute.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/execute.hpp index 0a9ea99bf3..ef2ff3204e 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/execute.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/execute.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/detail/as_invocable.hpp> #include <boost/asio/execution/detail/as_receiver.hpp> @@ -30,7 +33,8 @@ namespace boost { namespace asio { namespace execution { -/// A customisation point that executes a function on an executor. +/// (Deprecated: Use @c execute member function.) A customisation point that +/// executes a function on an executor. /** * The name <tt>execution::execute</tt> denotes a customisation point object. * @@ -54,7 +58,8 @@ namespace execution { */ inline constexpr unspecified execute = unspecified; -/// A type trait that determines whether a @c execute expression is well-formed. +/// (Deprecated.) A type trait that determines whether an @c execute expression +/// is well-formed. /** * Class template @c can_execute is a trait that is derived from * @c true_type if the expression <tt>execution::execute(std::declval<T>(), @@ -286,4 +291,6 @@ constexpr bool can_execute_v = can_execute<T, F>::value; #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_EXECUTE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/executor.hpp index b9f766b4b9..a0a0ff3613 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/executor.hpp @@ -17,9 +17,13 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/execution/execute.hpp> #include <boost/asio/execution/invocable_archetype.hpp> #include <boost/asio/traits/equality_comparable.hpp> +#include <boost/asio/traits/execute_member.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) +# include <boost/asio/execution/execute.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) #if defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_FREE_TRAIT) \ && defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) \ @@ -45,9 +49,15 @@ struct is_executor_of_impl : false_type template <typename T, typename F> struct is_executor_of_impl<T, F, +#if defined(BOOST_ASIO_NO_DEPRECATED) + typename enable_if< + traits::execute_member<typename add_const<T>::type, F>::is_valid + >::type, +#else // defined(BOOST_ASIO_NO_DEPRECATED) typename enable_if< can_execute<typename add_const<T>::type, F>::value >::type, +#endif // defined(BOOST_ASIO_NO_DEPRECATED) typename void_type< typename result_of<typename decay<F>::type&()>::type >::type, diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/mapping.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/mapping.hpp index b46ddfab73..0765ecae20 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/mapping.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/mapping.hpp @@ -193,6 +193,12 @@ template <int I = 0> struct mapping_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -206,7 +212,9 @@ struct mapping_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false); @@ -495,6 +503,12 @@ template <int I = 0> struct thread_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -508,7 +522,9 @@ struct thread_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -597,6 +613,12 @@ template <int I = 0> struct new_thread_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -610,7 +632,9 @@ struct new_thread_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -678,6 +702,12 @@ template <int I> struct other_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -691,7 +721,9 @@ struct other_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -774,6 +806,7 @@ template <typename T> struct is_applicable_property<T, execution::mapping_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -783,7 +816,9 @@ struct is_applicable_property<T, execution::mapping_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -791,6 +826,7 @@ template <typename T> struct is_applicable_property<T, execution::mapping_t::thread_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -800,7 +836,9 @@ struct is_applicable_property<T, execution::mapping_t::thread_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -808,6 +846,7 @@ template <typename T> struct is_applicable_property<T, execution::mapping_t::new_thread_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -817,7 +856,9 @@ struct is_applicable_property<T, execution::mapping_t::new_thread_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -825,6 +866,7 @@ template <typename T> struct is_applicable_property<T, execution::mapping_t::other_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -834,7 +876,9 @@ struct is_applicable_property<T, execution::mapping_t::other_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/occupancy.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/occupancy.hpp index 4716b5259e..af4e9cd737 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/occupancy.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/occupancy.hpp @@ -66,6 +66,12 @@ template <int I = 0> struct occupancy_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -79,7 +85,9 @@ struct occupancy_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false); @@ -173,6 +181,7 @@ template <typename T> struct is_applicable_property<T, execution::occupancy_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -182,7 +191,9 @@ struct is_applicable_property<T, execution::occupancy_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/operation_state.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/operation_state.hpp index 2d4b914069..7c356060bf 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/operation_state.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/operation_state.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/start.hpp> @@ -93,4 +96,6 @@ BOOST_ASIO_CONCEPT operation_state = is_operation_state<T>::value; #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_OPERATION_STATE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/outstanding_work.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/outstanding_work.hpp index eb8e342f3e..95d9da26a3 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/outstanding_work.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/outstanding_work.hpp @@ -159,6 +159,12 @@ template <int I = 0> struct outstanding_work_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -172,7 +178,9 @@ struct outstanding_work_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false); @@ -410,6 +418,12 @@ template <int I = 0> struct untracked_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -423,7 +437,9 @@ struct untracked_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -510,6 +526,12 @@ template <int I = 0> struct tracked_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -523,7 +545,9 @@ struct tracked_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -608,6 +632,7 @@ template <typename T> struct is_applicable_property<T, execution::outstanding_work_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -617,7 +642,9 @@ struct is_applicable_property<T, execution::outstanding_work_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -625,6 +652,7 @@ template <typename T> struct is_applicable_property<T, execution::outstanding_work_t::untracked_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -634,7 +662,9 @@ struct is_applicable_property<T, execution::outstanding_work_t::untracked_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -642,6 +672,7 @@ template <typename T> struct is_applicable_property<T, execution::outstanding_work_t::tracked_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -651,7 +682,9 @@ struct is_applicable_property<T, execution::outstanding_work_t::tracked_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/receiver.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/receiver.hpp index e51a04c13d..3c115a6418 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/receiver.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/receiver.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/variadic_templates.hpp> #include <boost/asio/execution/set_done.hpp> @@ -279,4 +282,6 @@ BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_NOTHROW_RECEIVER_OF_TRAITS_DEF) #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_RECEIVER_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/relationship.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/relationship.hpp index 161a5d92ed..488fce97be 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/relationship.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/relationship.hpp @@ -158,6 +158,12 @@ template <int I = 0> struct relationship_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -171,7 +177,9 @@ struct relationship_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = false); @@ -408,6 +416,12 @@ template <int I = 0> struct fork_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -421,7 +435,9 @@ struct fork_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -507,6 +523,12 @@ template <int I = 0> struct continuation_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) +# if defined(BOOST_ASIO_NO_DEPRECATED) + template <typename T> + BOOST_ASIO_STATIC_CONSTEXPR(bool, + is_applicable_property_v = ( + is_executor<T>::value)); +# else // defined(BOOST_ASIO_NO_DEPRECATED) template <typename T> BOOST_ASIO_STATIC_CONSTEXPR(bool, is_applicable_property_v = ( @@ -520,7 +542,9 @@ struct continuation_t is_executor<T>::value, false_type, is_scheduler<T> - >::type::value)); + >::type::value + )); +# endif // defined(BOOST_ASIO_NO_DEPRECATED) #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_requirable = true); @@ -606,6 +630,7 @@ template <typename T> struct is_applicable_property<T, execution::relationship_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -615,7 +640,9 @@ struct is_applicable_property<T, execution::relationship_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -623,6 +650,7 @@ template <typename T> struct is_applicable_property<T, execution::relationship_t::fork_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -632,7 +660,9 @@ struct is_applicable_property<T, execution::relationship_t::fork_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; @@ -640,6 +670,7 @@ template <typename T> struct is_applicable_property<T, execution::relationship_t::continuation_t> : integral_constant<bool, execution::is_executor<T>::value +#if !defined(BOOST_ASIO_NO_DEPRECATED) || conditional< execution::is_executor<T>::value, false_type, @@ -649,7 +680,9 @@ struct is_applicable_property<T, execution::relationship_t::continuation_t> execution::is_executor<T>::value, false_type, execution::is_scheduler<T> - >::type::value> + >::type::value +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + > { }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/schedule.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/schedule.hpp index c86e7fab7e..351d761df0 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/schedule.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/schedule.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/traits/schedule_member.hpp> @@ -288,4 +291,6 @@ constexpr bool is_nothrow_schedule_v #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_SCHEDULE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/scheduler.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/scheduler.hpp index 9856d0e9cd..881ad05859 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/scheduler.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/scheduler.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/schedule.hpp> #include <boost/asio/traits/equality_comparable.hpp> @@ -85,4 +88,6 @@ BOOST_ASIO_CONCEPT scheduler = is_scheduler<T>::value; #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_SCHEDULER_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/sender.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/sender.hpp index 011c04f226..396a6b7395 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/sender.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/sender.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/detail/as_invocable.hpp> #include <boost/asio/execution/detail/void_receiver.hpp> @@ -310,4 +313,6 @@ BOOST_ASIO_CONCEPT typed_sender = is_typed_sender<T>::value; #include <boost/asio/execution/connect.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_SENDER_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/set_done.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/set_done.hpp index 799a358e8e..5627ec6728 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/set_done.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/set_done.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/traits/set_done_member.hpp> #include <boost/asio/traits/set_done_free.hpp> @@ -251,4 +254,6 @@ constexpr bool is_nothrow_set_done_v #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_SET_DONE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/set_error.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/set_error.hpp index 3347fff34a..0ced6fb6c7 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/set_error.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/set_error.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/traits/set_error_member.hpp> #include <boost/asio/traits/set_error_free.hpp> @@ -251,4 +254,6 @@ constexpr bool is_nothrow_set_error_v #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_SET_ERROR_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/set_value.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/set_value.hpp index 0deb1d381b..6919e7d7ac 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/set_value.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/set_value.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/variadic_templates.hpp> #include <boost/asio/traits/set_value_member.hpp> @@ -484,4 +487,6 @@ BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_SET_VALUE_TRAITS_DEF) #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_SET_VALUE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/start.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/start.hpp index f87001b683..1fcbbf0e87 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/start.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/start.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/traits/start_member.hpp> #include <boost/asio/traits/start_free.hpp> @@ -248,4 +251,6 @@ constexpr bool is_nothrow_start_v #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_START_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/execution/submit.hpp b/contrib/restricted/boost/asio/include/boost/asio/execution/submit.hpp index ee8002c456..77dd4b4cef 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/execution/submit.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/execution/submit.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/detail/submit_receiver.hpp> #include <boost/asio/execution/executor.hpp> @@ -451,4 +454,6 @@ void submit_helper(BOOST_ASIO_MOVE_ARG(S) s, BOOST_ASIO_MOVE_ARG(R) r) #include <boost/asio/detail/pop_options.hpp> +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_EXECUTION_SUBMIT_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/executor_work_guard.hpp b/contrib/restricted/boost/asio/include/boost/asio/executor_work_guard.hpp index 9cb605635e..a83f346977 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/executor_work_guard.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/executor_work_guard.hpp @@ -289,17 +289,14 @@ make_work_guard(ExecutionContext& ctx, */ template <typename T> BOOST_ASIO_NODISCARD inline -executor_work_guard<typename associated_executor<T>::type> -make_work_guard(const T& t, +executor_work_guard< typename constraint< !is_executor<T>::value - >::type = 0, - typename constraint< - !execution::is_executor<T>::value - >::type = 0, - typename constraint< - !is_convertible<T&, execution_context&>::value - >::type = 0) + && !execution::is_executor<T>::value + && !is_convertible<T&, execution_context&>::value, + associated_executor<T> + >::type::type> +make_work_guard(const T& t) { return executor_work_guard<typename associated_executor<T>::type>( associated_executor<T>::get(t)); diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/basic_channel.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/basic_channel.hpp index ca34c8eb99..1a74a7c9eb 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/basic_channel.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/basic_channel.hpp @@ -283,7 +283,7 @@ public: } /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return executor_; } @@ -427,7 +427,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -456,7 +456,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/basic_concurrent_channel.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/basic_concurrent_channel.hpp index 73d006780b..d9666d3699 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/basic_concurrent_channel.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/basic_concurrent_channel.hpp @@ -290,7 +290,7 @@ public: } /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return executor_; } @@ -427,7 +427,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -456,7 +456,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/channel_traits.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/channel_traits.hpp index e259546ddb..97ed6f2268 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/channel_traits.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/channel_traits.hpp @@ -82,6 +82,40 @@ struct channel_traits }; }; +template <typename R> +struct channel_traits<R(boost::system::error_code)> +{ + template <typename... NewSignatures> + struct rebind + { + typedef channel_traits<NewSignatures...> other; + }; + + template <typename Element> + struct container + { + typedef std::deque<Element> type; + }; + + typedef R receive_cancelled_signature(boost::system::error_code); + + template <typename F> + static void invoke_receive_cancelled(F f) + { + const boost::system::error_code e = error::channel_cancelled; + BOOST_ASIO_MOVE_OR_LVALUE(F)(f)(e); + } + + typedef R receive_closed_signature(boost::system::error_code); + + template <typename F> + static void invoke_receive_closed(F f) + { + const boost::system::error_code e = error::channel_closed; + BOOST_ASIO_MOVE_OR_LVALUE(F)(f)(e); + } +}; + template <typename R, typename... Args, typename... Signatures> struct channel_traits<R(boost::system::error_code, Args...), Signatures...> { @@ -116,6 +150,42 @@ struct channel_traits<R(boost::system::error_code, Args...), Signatures...> } }; +template <typename R> +struct channel_traits<R(std::exception_ptr)> +{ + template <typename... NewSignatures> + struct rebind + { + typedef channel_traits<NewSignatures...> other; + }; + + template <typename Element> + struct container + { + typedef std::deque<Element> type; + }; + + typedef R receive_cancelled_signature(std::exception_ptr); + + template <typename F> + static void invoke_receive_cancelled(F f) + { + const boost::system::error_code e = error::channel_cancelled; + BOOST_ASIO_MOVE_OR_LVALUE(F)(f)( + std::make_exception_ptr(boost::system::system_error(e))); + } + + typedef R receive_closed_signature(std::exception_ptr); + + template <typename F> + static void invoke_receive_closed(F f) + { + const boost::system::error_code e = error::channel_closed; + BOOST_ASIO_MOVE_OR_LVALUE(F)(f)( + std::make_exception_ptr(boost::system::system_error(e))); + } +}; + template <typename R, typename... Args, typename... Signatures> struct channel_traits<R(std::exception_ptr, Args...), Signatures...> { diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/co_composed.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/co_composed.hpp new file mode 100644 index 0000000000..066d2d2bf7 --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/co_composed.hpp @@ -0,0 +1,146 @@ +// +// experimental/co_composed.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// 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) +// + +#ifndef BOOST_ASIO_EXPERIMENTAL_CO_COMPOSED_HPP +#define BOOST_ASIO_EXPERIMENTAL_CO_COMPOSED_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/async_result.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace experimental { + +/// Creates an initiation function object that may be used to launch a +/// coroutine-based composed asynchronous operation. +/** + * The experimental::co_composed utility simplifies the implementation of + * composed asynchronous operations by automatically adapting a coroutine to be + * an initiation function object for use with @c async_initiate. When awaiting + * asynchronous operations, the coroutine automatically uses a conforming + * intermediate completion handler. + * + * @param implementation A function object that contains the coroutine-based + * implementation of the composed asynchronous operation. The first argument to + * the function object represents the state of the operation, and may be used + * to test for cancellation. The remaining arguments are those passed to @c + * async_initiate after the completion token. + * + * @param io_objects_or_executors Zero or more I/O objects or I/O executors for + * which outstanding work must be maintained while the operation is incomplete. + * + * @par Per-Operation Cancellation + * By default, per-operation cancellation is disabled for composed operations + * that use experimental::co_composed. It must be explicitly enabled by calling + * the state's @c reset_cancellation_state function. + * + * @par Examples + * The following example illustrates manual error handling and explicit checks + * for cancellation. The completion handler is invoked via a @c co_yield to the + * state's @c complete function, which never returns. + * + * @code template <typename CompletionToken> + * auto async_echo(tcp::socket& socket, + * CompletionToken&& token) + * { + * return boost::asio::async_initiate< + * CompletionToken, void(boost::system::error_code)>( + * boost::asio::experimental::co_composed( + * [](auto state, tcp::socket& socket) -> void + * { + * state.reset_cancellation_state( + * boost::asio::enable_terminal_cancellation()); + * + * while (!state.cancelled()) + * { + * char data[1024]; + * auto [e1, n1] = + * co_await socket.async_read_some( + * boost::asio::buffer(data), + * boost::asio::as_tuple(boost::asio::deferred)); + * + * if (e1) + * co_yield state.complete(e1); + * + * if (!!state.cancelled()) + * co_yield state.complete( + * make_error_code(boost::asio::error::operation_aborted)); + * + * auto [e2, n2] = + * co_await boost::asio::async_write(socket, + * boost::asio::buffer(data, n1), + * boost::asio::as_tuple(boost::asio::deferred)); + * + * if (e2) + * co_yield state.complete(e2); + * } + * }, socket), + * token, std::ref(socket)); + * } @endcode + * + * This next example shows exception-based error handling and implicit checks + * for cancellation. The completion handler is invoked after returning from the + * coroutine via @c co_return. Valid @c co_return values are specified using + * completion signatures passed to the @c co_composed function. + * + * @code template <typename CompletionToken> + * auto async_echo(tcp::socket& socket, + * CompletionToken&& token) + * { + * return boost::asio::async_initiate< + * CompletionToken, void(boost::system::error_code)>( + * boost::asio::experimental::co_composed< + * void(boost::system::error_code)>( + * [](auto state, tcp::socket& socket) -> void + * { + * try + * { + * state.throw_if_cancelled(true); + * state.reset_cancellation_state( + * boost::asio::enable_terminal_cancellation()); + * + * for (;;) + * { + * char data[1024]; + * std::size_t n = co_await socket.async_read_some( + * boost::asio::buffer(data), boost::asio::deferred); + * + * co_await boost::asio::async_write(socket, + * boost::asio::buffer(data, n), boost::asio::deferred); + * } + * } + * catch (const std::system_error& e) + * { + * co_return {e.code()}; + * } + * }, socket), + * token, std::ref(socket)); + * } @endcode + */ +template <completion_signature... Signatures, + typename Implementation, typename... IoObjectsOrExecutors> +auto co_composed(Implementation&& implementation, + IoObjectsOrExecutors&&... io_objects_or_executors); + +} // namespace experimental +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#include <boost/asio/experimental/impl/co_composed.hpp> + +#endif // BOOST_ASIO_EXPERIMENTAL_CO_COMPOSED_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/coro.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/coro.hpp index f32bf00aad..718d64fd14 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/coro.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/coro.hpp @@ -23,7 +23,6 @@ #include <boost/asio/experimental/coro_traits.hpp> #include <boost/asio/experimental/detail/coro_promise_allocator.hpp> #include <boost/asio/experimental/detail/partial_promise.hpp> -#include <boost/asio/experimental/use_coro.hpp> #include <boost/asio/post.hpp> #include <boost/asio/detail/push_options.hpp> @@ -33,6 +32,10 @@ namespace asio { namespace experimental { namespace detail { +template <typename Signature, typename Return, + typename Executor, typename Allocator> +struct coro_promise; + template <typename T, typename Coroutine> struct coro_with_arg; @@ -45,7 +48,8 @@ struct coro_with_arg; * the underlying executor type. */ template <typename Yield = void, typename Return = void, - typename Executor = any_io_executor> + typename Executor = any_io_executor, + typename Allocator = std::allocator<void>> struct coro { /// The traits of the coroutine. See boost::asio::experimental::coro_traits @@ -79,7 +83,7 @@ struct coro using completion_handler = typename traits::completion_handler; /// The internal promise-type of the coroutine. - using promise_type = detail::coro_promise<Yield, Return, Executor>; + using promise_type = detail::coro_promise<Yield, Return, Executor, Allocator>; #if !defined(GENERATING_DOCUMENTATION) template <typename T, typename Coroutine> @@ -89,8 +93,11 @@ struct coro /// The executor type. using executor_type = Executor; + /// The allocator type. + using allocator_type = Allocator; + #if !defined(GENERATING_DOCUMENTATION) - friend struct detail::coro_promise<Yield, Return, Executor>; + friend struct detail::coro_promise<Yield, Return, Executor, Allocator>; #endif // !defined(GENERATING_DOCUMENTATION) /// The default constructor, gives an invalid coroutine. @@ -102,7 +109,7 @@ struct coro { } - coro(const coro &) = delete; + coro(const coro&) = delete; /// Move assignment. coro& operator=(coro&& lhs) noexcept @@ -166,6 +173,19 @@ struct coro throw std::logic_error("Coroutine has no executor"); } + /// Get the used allocator. + allocator_type get_allocator() const + { + if (coro_) + return coro_->get_allocator(); + + if constexpr (std::is_default_constructible_v<Allocator>) + return Allocator{}; + else + throw std::logic_error( + "Coroutine has no available allocator without a constructed promise"); + } + /// Resume the coroutine. /** * @param token The completion token of the async resume. @@ -254,6 +274,16 @@ private: promise_type* coro_{nullptr}; }; +/// A generator is a coro that returns void and yields value. +template<typename T, typename Executor = boost::asio::any_io_executor, + typename Allocator = std::allocator<void>> +using generator = coro<T, void, Executor, Allocator>; + +/// A task is a coro that does not yield values +template<typename T, typename Executor = boost::asio::any_io_executor, + typename Allocator = std::allocator<void>> +using task = coro<void(), T, Executor, Allocator>; + } // namespace experimental } // namespace asio } // namespace boost diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_handler.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_handler.hpp index 84d6dfb972..aee027aaf2 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_handler.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_handler.hpp @@ -56,9 +56,19 @@ struct associator<Associator, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const experimental::detail::channel_handler<Payload, Handler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const experimental::detail::channel_handler<Payload, Handler>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const experimental::detail::channel_handler<Payload, Handler>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_operation.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_operation.hpp index f2a2907ce0..180476e412 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_operation.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_operation.hpp @@ -94,11 +94,18 @@ public: typename associated_allocator<Handler>::type allocator = (get_associated_allocator)(handler); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer( + boost::asio::require(executor_, execution::blocking.never), + execution::allocator(allocator) + ).execute(BOOST_ASIO_MOVE_CAST(Function)(function)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::prefer( boost::asio::require(executor_, execution::blocking.never), execution::allocator(allocator)), BOOST_ASIO_MOVE_CAST(Function)(function)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } private: diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_service.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_service.hpp index f8520a4ef3..628646ff95 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_service.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/channel_service.hpp @@ -487,6 +487,186 @@ private: std::size_t buffer_; }; +// The implementation for an error_code signature. +template <typename Mutex> +template <typename Traits, typename R> +struct channel_service<Mutex>::implementation_type< + Traits, R(boost::system::error_code)> + : channel_service::base_implementation_type +{ + // The traits type associated with the channel. + typedef typename Traits::template rebind<R(boost::system::error_code)>::other + traits_type; + + // Type of an element stored in the buffer. + typedef typename conditional< + has_signature< + typename traits_type::receive_cancelled_signature, + R(boost::system::error_code) + >::value, + typename conditional< + has_signature< + typename traits_type::receive_closed_signature, + R(boost::system::error_code) + >::value, + channel_payload<R(boost::system::error_code)>, + channel_payload< + R(boost::system::error_code), + typename traits_type::receive_closed_signature + > + >::type, + typename conditional< + has_signature< + typename traits_type::receive_closed_signature, + R(boost::system::error_code), + typename traits_type::receive_cancelled_signature + >::value, + channel_payload< + R(boost::system::error_code), + typename traits_type::receive_cancelled_signature + >, + channel_payload< + R(boost::system::error_code), + typename traits_type::receive_cancelled_signature, + typename traits_type::receive_closed_signature + > + >::type + >::type payload_type; + + // Construct with empty buffer. + implementation_type() + : size_(0) + { + } + + // Move from another buffer. + void buffer_move_from(implementation_type& other) + { + size_ = other.buffer_; + other.size_ = 0; + first_ = other.first_; + other.first.count_ = 0; + rest_ = BOOST_ASIO_MOVE_CAST( + typename traits_type::template container< + buffered_value>::type)(other.rest_); + other.buffer_clear(); + } + + // Get number of buffered elements. + std::size_t buffer_size() const + { + return size_; + } + + // Push a new value to the back of the buffer. + void buffer_push(payload_type payload) + { + buffered_value& last = rest_.empty() ? first_ : rest_.back(); + if (last.count_ == 0) + { + value_handler handler{last.value_}; + payload.receive(handler); + last.count_ = 1; + } + else + { + boost::system::error_code value{last.value_}; + value_handler handler{value}; + payload.receive(handler); + if (last.value_ == value) + ++last.count_; + else + rest_.push_back({value, 1}); + } + ++size_; + } + + // Push new values to the back of the buffer. + std::size_t buffer_push_n(std::size_t count, payload_type payload) + { + std::size_t available = this->max_buffer_size_ - size_; + count = (count < available) ? count : available; + if (count > 0) + { + buffered_value& last = rest_.empty() ? first_ : rest_.back(); + if (last.count_ == 0) + { + payload.receive(value_handler{last.value_}); + last.count_ = count; + } + else + { + boost::system::error_code value{last.value_}; + payload.receive(value_handler{value}); + if (last.value_ == value) + last.count_ += count; + else + rest_.push_back({value, count}); + } + size_ += count; + } + return count; + } + + // Get the element at the front of the buffer. + payload_type buffer_front() + { + return payload_type({0, first_.value_}); + } + + // Pop a value from the front of the buffer. + void buffer_pop() + { + --size_; + if (--first_.count_ == 0 && !rest_.empty()) + { + first_ = rest_.front(); + rest_.pop_front(); + } + } + + // Clear all values from the buffer. + void buffer_clear() + { + size_ = 0; + first_.count_ == 0; + rest_.clear(); + } + +private: + struct buffered_value + { + boost::system::error_code value_; + std::size_t count_ = 0; + }; + + struct value_handler + { + boost::system::error_code& target_; + + template <typename... Args> + void operator()(const boost::system::error_code& value, Args&&...) + { + target_ = value; + } + }; + + buffered_value& last_value() + { + return rest_.empty() ? first_ : rest_.back(); + } + + // Total number of buffered values. + std::size_t size_; + + // The first buffered value is maintained as a separate data member to avoid + // allocating space in the container in the common case. + buffered_value first_; + + // The rest of the buffered values. + typename traits_type::template container<buffered_value>::type rest_; +}; + } // namespace detail } // namespace experimental } // namespace asio diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/completion_handler_erasure.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/completion_handler_erasure.hpp deleted file mode 100644 index c3e03f3d87..0000000000 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/completion_handler_erasure.hpp +++ /dev/null @@ -1,196 +0,0 @@ -// -// experimental/detail/completion_handler_erasure.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2021-2022 Klemens D. Morgenstern -// (klemens dot morgenstern at gmx dot net) -// -// 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 BOOST_ASIO_EXPERIMENTAL_DETAIL_COMPLETION_HANDLER_ERASURE_HPP -#define BOOST_ASIO_EXPERIMENTAL_DETAIL_COMPLETION_HANDLER_ERASURE_HPP - -#include <new> -#include <boost/asio/associated_allocator.hpp> -#include <boost/asio/dispatch.hpp> - -namespace boost { -namespace asio { - -class any_io_executor; - -namespace experimental { -namespace detail { - -template<typename Signature, typename Executor> -struct completion_handler_erasure_base; - -template<typename Func, typename Signature, typename Executor> -struct completion_handler_erasure_impl; - -template<typename Return, typename... Args, typename Executor> -struct completion_handler_erasure_base<Return(Args...), Executor> -{ - Executor executor; - - completion_handler_erasure_base(Executor&& executor) - : executor(std::move(executor)) - { - } - - virtual Return call(Args... args) = 0; - virtual void destroy() = 0; - virtual ~completion_handler_erasure_base() = default; -}; - -template<typename Func, typename Return, typename... Args, typename Executor> -struct completion_handler_erasure_impl<Func, Return(Args...), Executor> final - : completion_handler_erasure_base<Return(Args...), Executor> -{ - using allocator_base = typename associated_allocator<Func>::type; - using allocator_type = - typename std::allocator_traits<allocator_base>::template rebind_alloc< - completion_handler_erasure_impl>; - - completion_handler_erasure_impl(Executor&& exec, Func&& func) - : completion_handler_erasure_base<Return(Args...), Executor>( - std::move(exec)), func(std::move(func)) - { - } - - struct uninit_deleter_t - { - allocator_type allocator; - - uninit_deleter_t(const Func& func) - : allocator(get_associated_allocator(func)) - { - } - - void operator()(completion_handler_erasure_impl* p) - { - std::allocator_traits<allocator_type>::deallocate(allocator, p, 1); - } - }; - - static completion_handler_erasure_impl* make(Executor exec, Func&& func) - { - uninit_deleter_t deleter(func); - std::unique_ptr<completion_handler_erasure_impl, uninit_deleter_t> - uninit_ptr(std::allocator_traits<allocator_type>::allocate( - deleter.allocator, 1), deleter); - completion_handler_erasure_impl* ptr = - new (uninit_ptr.get()) completion_handler_erasure_impl( - std::move(exec), std::move(func)); - uninit_ptr.release(); - return ptr; - } - - struct deleter_t - { - allocator_type allocator; - - deleter_t(const Func& func) - : allocator(get_associated_allocator(func)) - { - } - - void operator()(completion_handler_erasure_impl* p) - { - std::allocator_traits<allocator_type>::destroy(allocator, p); - std::allocator_traits<allocator_type>::deallocate(allocator, p, 1); - } - }; - - virtual Return call(Args... args) override - { - std::unique_ptr<completion_handler_erasure_impl, - deleter_t> p(this, deleter_t(func)); - Func f(std::move(func)); - p.reset(); - std::move(f)(std::move(args)...); - } - - virtual void destroy() override - { - std::unique_ptr<completion_handler_erasure_impl, - deleter_t>(this, deleter_t(func)); - } - - Func func; -}; - -template<typename Signature, typename Executor = any_io_executor> -struct completion_handler_erasure; - -template<typename Return, typename... Args, typename Executor> -struct completion_handler_erasure<Return(Args...), Executor> -{ - struct deleter_t - { - void operator()( - completion_handler_erasure_base<Return(Args...), Executor>* p) - { - p->destroy(); - } - }; - - completion_handler_erasure(const completion_handler_erasure&) = delete; - completion_handler_erasure(completion_handler_erasure&&) = default; - completion_handler_erasure& operator=( - const completion_handler_erasure&) = delete; - completion_handler_erasure& operator=( - completion_handler_erasure&&) = default; - - constexpr completion_handler_erasure() = default; - - constexpr completion_handler_erasure(nullptr_t) - : completion_handler_erasure() - { - } - - template<typename Func> - completion_handler_erasure(Executor exec, Func&& func) - : impl_(completion_handler_erasure_impl< - std::decay_t<Func>, Return(Args...), Executor>::make( - std::move(exec), std::forward<Func>(func))) - { - } - - ~completion_handler_erasure() - { - if (impl_) - { - Executor executor(impl_->executor); - boost::asio::dispatch(executor, - [impl = std::move(impl_)]() mutable - { - impl.reset(); - }); - } - } - - Return operator()(Args... args) - { - if (impl_) - impl_.release()->call(std::move(args)...); - } - - constexpr bool operator==(nullptr_t) const noexcept {return impl_ == nullptr;} - constexpr bool operator!=(nullptr_t) const noexcept {return impl_ != nullptr;} - constexpr bool operator!() const noexcept {return impl_ == nullptr;} - -private: - std::unique_ptr< - completion_handler_erasure_base<Return(Args...), Executor>, deleter_t> - impl_; -}; - -} // namespace detail -} // namespace experimental -} // namespace asio -} // namespace boost - -#endif // BOOST_ASIO_EXPERIMENTAL_DETAIL_COMPLETION_HANDLER_ERASURE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/coro_completion_handler.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/coro_completion_handler.hpp new file mode 100644 index 0000000000..d2bbbf2e72 --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/coro_completion_handler.hpp @@ -0,0 +1,171 @@ +// +// experimental/detail/coro_completion_handler.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2021-2022 Klemens D. Morgenstern +// (klemens dot morgenstern at gmx dot net) +// +// 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 BOOST_ASIO_EXPERIMENTAL_DETAIL_CORO_COMPLETION_HANDLER_HPP +#define BOOST_ASIO_EXPERIMENTAL_DETAIL_CORO_COMPLETION_HANDLER_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/deferred.hpp> +#include <boost/asio/experimental/coro.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace experimental { +namespace detail { + +template <typename Promise, typename... Args> +struct coro_completion_handler +{ + coro_completion_handler(coroutine_handle<Promise> h, + std::optional<std::tuple<Args...>>& result) + : self(h), + result(result) + { + } + + coro_completion_handler(coro_completion_handler&&) = default; + + coroutine_handle<Promise> self; + + std::optional<std::tuple<Args...>>& result; + + using promise_type = Promise; + + void operator()(Args... args) + { + result.emplace(std::move(args)...); + self.resume(); + } + + using allocator_type = typename promise_type::allocator_type; + allocator_type get_allocator() const noexcept + { + return self.promise().get_allocator(); + } + + using executor_type = typename promise_type::executor_type; + executor_type get_executor() const noexcept + { + return self.promise().get_executor(); + } + + using cancellation_slot_type = typename promise_type::cancellation_slot_type; + cancellation_slot_type get_cancellation_slot() const noexcept + { + return self.promise().get_cancellation_slot(); + } +}; + +template <typename Signature> +struct coro_completion_handler_type; + +template <typename... Args> +struct coro_completion_handler_type<void(Args...)> +{ + using type = std::tuple<Args...>; + + template <typename Promise> + using completion_handler = coro_completion_handler<Promise, Args...>; +}; + +template <typename Signature> +using coro_completion_handler_type_t = + typename coro_completion_handler_type<Signature>::type; + +inline void coro_interpret_result(std::tuple<>&&) +{ +} + +template <typename... Args> +inline auto coro_interpret_result(std::tuple<Args...>&& args) +{ + return std::move(args); +} + +template <typename... Args> +auto coro_interpret_result(std::tuple<std::exception_ptr, Args...>&& args) +{ + if (std::get<0>(args)) + std::rethrow_exception(std::get<0>(args)); + + return std::apply( + [](auto, auto&&... rest) + { + return std::make_tuple(std::move(rest)...); + }); +} + +template <typename... Args> +auto coro_interpret_result( + std::tuple<boost::system::error_code, Args...>&& args) +{ + if (std::get<0>(args)) + boost::asio::detail::throw_exception( + boost::system::system_error(std::get<0>(args))); + + return std::apply( + [](auto, auto&&... rest) + { + return std::make_tuple(std::move(rest)...); + }); +} + +template <typename Arg> +inline auto coro_interpret_result(std::tuple<Arg>&& args) +{ + return std::get<0>(std::move(args)); +} + +template <typename Arg> +auto coro_interpret_result(std::tuple<std::exception_ptr, Arg>&& args) +{ + if (std::get<0>(args)) + std::rethrow_exception(std::get<0>(args)); + return std::get<1>(std::move(args)); +} + +inline auto coro_interpret_result( + std::tuple<boost::system::error_code>&& args) +{ + if (std::get<0>(args)) + boost::asio::detail::throw_exception( + boost::system::system_error(std::get<0>(args))); +} + +inline auto coro_interpret_result(std::tuple<std::exception_ptr>&& args) +{ + if (std::get<0>(args)) + std::rethrow_exception(std::get<0>(args)); +} + +template <typename Arg> +auto coro_interpret_result(std::tuple<boost::system::error_code, Arg>&& args) +{ + if (std::get<0>(args)) + boost::asio::detail::throw_exception( + boost::system::system_error(std::get<0>(args))); + return std::get<1>(std::move(args)); +} + +} // namespace detail +} // namespace experimental +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_EXPERIMENTAL_DETAIL_CORO_COMPLETION_HANDLER_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/coro_promise_allocator.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/coro_promise_allocator.hpp index 6c7699ebf9..a459a06784 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/coro_promise_allocator.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/coro_promise_allocator.hpp @@ -20,95 +20,118 @@ namespace asio { namespace experimental { namespace detail { -template <typename Coroutine, - typename Executor = typename Coroutine::executor_type, - typename Allocator = typename std::allocator_traits< - associated_allocator_t<Executor>>:: template rebind_alloc<std::byte>, - bool Noexcept = noexcept(std::declval<Allocator>().allocate(0u))> -struct coro_promise_allocator +/// Allocate the memory and put the allocator behind the coro memory +template <typename AllocatorType> +void* allocate_coroutine(const std::size_t size, AllocatorType alloc_) { - using allocator_type = Allocator; + using alloc_type = typename std::allocator_traits<AllocatorType>::template + rebind_alloc<unsigned char>; + alloc_type alloc{alloc_}; + + const auto align_needed = size % alignof(alloc_type); + const auto align_offset = align_needed != 0 + ? alignof(alloc_type) - align_needed : 0ull; + const auto alloc_size = size + sizeof(alloc_type) + align_offset; + const auto raw = + std::allocator_traits<alloc_type>::allocate(alloc, alloc_size); + new(raw + size + align_offset) alloc_type(std::move(alloc)); + + return raw; +} + +/// Deallocate the memory and destroy the allocator in the coro memory. +template <typename AllocatorType> +void deallocate_coroutine(void* raw_, const std::size_t size) +{ + using alloc_type = typename std::allocator_traits<AllocatorType>::template + rebind_alloc<unsigned char>; - template <typename... Args> - void* operator new(const std::size_t size, Executor executor, Args&&...) - { - static_assert(std::is_nothrow_move_constructible_v<allocator_type>); - allocator_type alloc{get_associated_allocator(executor)}; - - const auto csize = size + sizeof(alloc); - const auto raw = - std::allocator_traits<allocator_type>::allocate(alloc, csize); - new (raw) allocator_type(std::move(alloc)); - return static_cast<std::byte*>(raw) + sizeof(alloc); - } + const auto raw = static_cast<unsigned char *>(raw_); - template <execution_context Context, typename... Args> - void* operator new(const std::size_t size, Context&& ctx, Args&&... args) - { - return coro_promise_allocator::operator new(size, - ctx.get_executor(), std::forward<Args>(args)...); - } + const auto align_needed = size % alignof(alloc_type); + const auto align_offset = align_needed != 0 + ? alignof(alloc_type) - align_needed : 0ull; + const auto alloc_size = size + sizeof(alloc_type) + align_offset; - void operator delete(void* raw, std::size_t size ) - { - auto * alloc_p = static_cast<allocator_type*>(raw); + auto alloc_p = reinterpret_cast<alloc_type *>(raw + size + align_offset); + auto alloc = std::move(*alloc_p); + alloc_p->~alloc_type(); + std::allocator_traits<alloc_type>::deallocate(alloc, raw, alloc_size); +} + +template <typename T> +constexpr std::size_t variadic_first(std::size_t = 0u) +{ + return std::numeric_limits<std::size_t>::max(); +} - auto alloc = std::move(*alloc_p); - alloc_p->~allocator_type(); - std::allocator_traits<allocator_type>::deallocate(alloc, - static_cast<std::byte*>(raw), size + sizeof(allocator_type)); - } -}; -template <typename Coroutine, typename Executor> -struct coro_promise_allocator<Coroutine, - Executor, std::allocator<std::byte>, false> +template <typename T, typename First, typename... Args> +constexpr std::size_t variadic_first(std::size_t pos = 0u) { + if constexpr (std::is_same_v<std::decay_t<First>, T>) + return pos; + else + return variadic_first<T, Args...>(pos+1); +} + +template <std::size_t Idx, typename First, typename... Args> + requires (Idx <= sizeof...(Args)) +constexpr decltype(auto) get_variadic(First&& first, Args&&... args) +{ + if constexpr (Idx == 0u) + return static_cast<First>(first); + else + return get_variadic<Idx-1u>(static_cast<Args>(args)...); +} -}; +template <std::size_t Idx> +constexpr decltype(auto) get_variadic(); -template <typename Coroutine, typename Executor, typename Allocator> -struct coro_promise_allocator<Coroutine, Executor, Allocator, true> +template <typename Allocator> +struct coro_promise_allocator { using allocator_type = Allocator; + allocator_type get_allocator() const {return alloc_;} template <typename... Args> - void* operator new(const std::size_t size, - Executor executor, Args&&...) noexcept + void* operator new(const std::size_t size, Args & ... args) + { + return allocate_coroutine(size, + get_variadic<variadic_first<std::allocator_arg_t, + std::decay_t<Args>...>() + 1u>(args...)); + } + + void operator delete(void* raw, const std::size_t size) { - static_assert(std::is_nothrow_move_constructible_v<allocator_type>); - allocator_type alloc{get_associated_allocator(executor)}; - - const auto csize = size + sizeof(alloc); - const auto raw = - std::allocator_traits<allocator_type>::allocate(alloc, csize); - if (raw == nullptr) - return nullptr; - new (raw) allocator_type(std::move(alloc)); - return static_cast<std::byte*>(raw) + sizeof(alloc); + deallocate_coroutine<allocator_type>(raw, size); } - template <execution_context Context, typename... Args> - void* operator new(const std::size_t size, - Context&& ctx, Args&&... args) noexcept + template <typename... Args> + coro_promise_allocator(Args&& ... args) + : alloc_( + get_variadic<variadic_first<std::allocator_arg_t, + std::decay_t<Args>...>() + 1u>(args...)) { - return coro_promise_allocator::operator new(size, - ctx.get_executor(), std::forward<Args>(args)...); } - void operator delete(void* raw, std::size_t size) noexcept +private: + allocator_type alloc_; +}; + +template <> +struct coro_promise_allocator<std::allocator<void>> +{ + using allocator_type = std::allocator<void>; + + template <typename... Args> + coro_promise_allocator(Args&&...) { - auto * alloc_p = static_cast<allocator_type*>(raw); - auto alloc = std::move(*alloc_p); - alloc_p->~allocator_type(); - const auto csize = size + sizeof(allocator_type); - std::allocator_traits<allocator_type>::deallocate(alloc, - static_cast<std::byte*>(raw) - sizeof(allocator_type), csize); } - static auto get_return_object_on_allocation_failure() noexcept -> Coroutine + allocator_type get_allocator() const { - return Coroutine{}; + return {}; } }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/partial_promise.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/partial_promise.hpp index 630d7ea921..56805e183c 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/partial_promise.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/detail/partial_promise.hpp @@ -13,6 +13,7 @@ #define BOOST_ASIO_EXPERIMENTAL_DETAIL_PARTIAL_PROMISE_HPP #include <boost/asio/detail/config.hpp> +#include <boost/asio/append.hpp> #include <boost/asio/awaitable.hpp> #include <boost/asio/experimental/coro_traits.hpp> @@ -45,7 +46,33 @@ using std::experimental::noop_coroutine; #endif // defined(BOOST_ASIO_HAS_STD_COROUTINE) -struct partial_promise +struct partial_coro +{ + coroutine_handle<void> handle{nullptr}; +}; + +template <typename Allocator> +struct partial_promise_base +{ + template <typename Executor, typename Token, typename... Args> + void* operator new(const std::size_t size, Executor&, Token& tk, Args&...) + { + return allocate_coroutine<Allocator>(size, get_associated_allocator(tk)); + } + + void operator delete(void* raw, const std::size_t size) + { + deallocate_coroutine<Allocator>(raw, size); + } +}; + +template <> +struct partial_promise_base<std::allocator<void>> +{ +}; + +template <typename Allocator> +struct partial_promise : partial_promise_base<Allocator> { auto initial_suspend() noexcept { @@ -62,7 +89,7 @@ struct partial_promise auto await_suspend(boost::asio::detail::coroutine_handle<>) noexcept { - p->get_return_object().destroy(); + p->get_return_object().handle.destroy(); } constexpr void await_resume() noexcept {} @@ -73,9 +100,9 @@ struct partial_promise void return_void() {} - coroutine_handle<partial_promise> get_return_object() + partial_coro get_return_object() { - return coroutine_handle<partial_promise>::from_promise(*this); + return partial_coro{coroutine_handle<partial_promise>::from_promise(*this)}; } void unhandled_exception() @@ -84,7 +111,9 @@ struct partial_promise } }; -} // namespace detail + + +}; // namespace detail } // namespace experimental } // namespace asio } // namespace boost @@ -93,12 +122,14 @@ struct partial_promise namespace std { -template <typename ... Args> +template <typename Executor, typename Completion, typename... Args> struct coroutine_traits< - coroutine_handle<boost::asio::experimental::detail::partial_promise>, - Args...> + boost::asio::experimental::detail::partial_coro, + Executor, Completion, Args...> { - using promise_type = boost::asio::experimental::detail::partial_promise; + using promise_type = + boost::asio::experimental::detail::partial_promise< + boost::asio::associated_allocator_t<Completion>>; }; } // namespace std @@ -107,12 +138,14 @@ struct coroutine_traits< namespace std { namespace experimental { -template <typename... Args> +template <typename Executor, typename Completion, typename... Args> struct coroutine_traits< - coroutine_handle<boost::asio::experimental::detail::partial_promise>, - Args...> + boost::asio::experimental::detail::partial_coro, + Executor, Completion, Args...> { - using promise_type = boost::asio::experimental::detail::partial_promise; + using promise_type = + boost::asio::experimental::detail::partial_promise< + boost::asio::associated_allocator_t<Completion>>; }; }} // namespace std::experimental @@ -124,51 +157,39 @@ namespace asio { namespace experimental { namespace detail { -template <typename CompletionToken> -auto post_coroutine(CompletionToken token) noexcept - -> coroutine_handle<partial_promise> -{ - post(std::move(token)); - co_return; -} - -template <execution::executor Executor, typename CompletionToken> -auto post_coroutine(Executor exec, CompletionToken token) noexcept - -> coroutine_handle<partial_promise> -{ - post(exec, std::move(token)); - co_return; -} - -template <detail::execution_context Context, typename CompletionToken> -auto post_coroutine(Context &ctx, CompletionToken token) noexcept - -> coroutine_handle<partial_promise> +template <execution::executor Executor, + typename CompletionToken, typename... Args> +partial_coro post_coroutine(Executor exec, + CompletionToken token, Args&&... args) noexcept { - post(ctx, std::move(token)); + post(exec, boost::asio::append(std::move(token), std::move(args)...)); co_return; } -template <typename CompletionToken> -auto dispatch_coroutine(CompletionToken token) noexcept - -> coroutine_handle<partial_promise> +template <detail::execution_context Context, + typename CompletionToken, typename... Args> +partial_coro post_coroutine(Context& ctx, + CompletionToken token, Args&&... args) noexcept { - dispatch(std::move(token)); + post(ctx, boost::asio::append(std::move(token), std::move(args)...)); co_return; } -template <execution::executor Executor, typename CompletionToken> -auto dispatch_coroutine(Executor exec, CompletionToken token) noexcept - -> coroutine_handle<partial_promise> +template <execution::executor Executor, + typename CompletionToken, typename... Args> +partial_coro dispatch_coroutine(Executor exec, + CompletionToken token, Args&&... args) noexcept { - dispatch(exec, std::move(token)); + dispatch(exec, boost::asio::append(std::move(token), std::move(args)...)); co_return; } -template <detail::execution_context Context, typename CompletionToken> -auto dispatch_coroutine(Context &ctx, CompletionToken token) noexcept - -> coroutine_handle<partial_promise> +template <detail::execution_context Context, + typename CompletionToken, typename... Args> +partial_coro dispatch_coroutine(Context& ctx, + CompletionToken token, Args &&... args) noexcept { - dispatch(ctx, std::move(token)); + dispatch(ctx, boost::asio::append(std::move(token), std::move(args)...)); co_return; } diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/as_single.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/as_single.hpp index c84b14bc8d..7749ce2371 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/as_single.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/as_single.hpp @@ -213,9 +213,19 @@ struct associator<Associator, experimental::detail::as_single_handler<Handler>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const experimental::detail::as_single_handler<Handler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const experimental::detail::as_single_handler<Handler>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const experimental::detail::as_single_handler<Handler>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/co_composed.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/co_composed.hpp new file mode 100644 index 0000000000..2134b32cb7 --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/co_composed.hpp @@ -0,0 +1,1134 @@ +// +// experimental/impl/co_composed.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// 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) +// + +#ifndef BOOST_ASIO_IMPL_EXPERIMENTAL_CO_COMPOSED_HPP +#define BOOST_ASIO_IMPL_EXPERIMENTAL_CO_COMPOSED_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <new> +#include <tuple> +#include <variant> +#include <boost/asio/associated_cancellation_slot.hpp> +#include <boost/asio/associator.hpp> +#include <boost/asio/async_result.hpp> +#include <boost/asio/cancellation_state.hpp> +#include <boost/asio/detail/composed_work.hpp> +#include <boost/asio/detail/recycling_allocator.hpp> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/detail/type_traits.hpp> +#include <boost/asio/error.hpp> + +#if defined(BOOST_ASIO_HAS_STD_COROUTINE) +# include <coroutine> +#else // defined(BOOST_ASIO_HAS_STD_COROUTINE) +# error #include <experimental/coroutine> +#endif // defined(BOOST_ASIO_HAS_STD_COROUTINE) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace experimental { +namespace detail { + +#if defined(BOOST_ASIO_HAS_STD_COROUTINE) +using std::coroutine_handle; +using std::suspend_always; +using std::suspend_never; +#else // defined(BOOST_ASIO_HAS_STD_COROUTINE) +using std::experimental::coroutine_handle; +using std::experimental::suspend_always; +using std::experimental::suspend_never; +#endif // defined(BOOST_ASIO_HAS_STD_COROUTINE) + +using boost::asio::detail::composed_io_executors; +using boost::asio::detail::composed_work; +using boost::asio::detail::composed_work_guard; +using boost::asio::detail::get_composed_io_executor; +using boost::asio::detail::make_composed_io_executors; +using boost::asio::detail::recycling_allocator; +using boost::asio::detail::throw_error; + +template <typename Executors, typename Handler, typename Return> +class co_composed_state; + +template <typename Executors, typename Handler, typename Return> +class co_composed_handler_base; + +template <typename Executors, typename Handler, typename Return> +class co_composed_promise; + +template <completion_signature... Signatures> +class co_composed_returns +{ +}; + +struct co_composed_on_suspend +{ + void (*fn_)(void*) = nullptr; + void* arg_ = nullptr; +}; + +template <typename... T> +struct co_composed_completion : std::tuple<T&&...> +{ + template <typename... U> + co_composed_completion(U&&... u) noexcept + : std::tuple<T&&...>(std::forward<U>(u)...) + { + } +}; + +template <typename Executors, typename Handler, + typename Return, typename Signature> +class co_composed_state_return_overload; + +template <typename Executors, typename Handler, + typename Return, typename R, typename... Args> +class co_composed_state_return_overload< + Executors, Handler, Return, R(Args...)> +{ +public: + using derived_type = co_composed_state<Executors, Handler, Return>; + using promise_type = co_composed_promise<Executors, Handler, Return>; + using return_type = std::tuple<Args...>; + + void on_cancellation_complete_with(Args... args) + { + derived_type& state = *static_cast<derived_type*>(this); + state.return_value_ = std::make_tuple(std::move(args)...); + state.cancellation_on_suspend_fn( + [](void* p) + { + auto& promise = *static_cast<promise_type*>(p); + + co_composed_handler_base<Executors, Handler, + Return> composed_handler(promise); + + Handler handler(std::move(promise.state().handler_)); + return_type result( + std::move(std::get<return_type>(promise.state().return_value_))); + + co_composed_handler_base<Executors, Handler, + Return>(std::move(composed_handler)); + + std::apply(std::move(handler), std::move(result)); + }); + } +}; + +template <typename Executors, typename Handler, typename Return> +class co_composed_state_return; + +template <typename Executors, typename Handler, typename... Signatures> +class co_composed_state_return< + Executors, Handler, co_composed_returns<Signatures...>> + : public co_composed_state_return_overload<Executors, + Handler, co_composed_returns<Signatures...>, Signatures>... +{ +public: + using co_composed_state_return_overload<Executors, + Handler, co_composed_returns<Signatures...>, + Signatures>::on_cancellation_complete_with...; + +private: + template <typename, typename, typename, typename> + friend class co_composed_promise_return_overload; + template <typename, typename, typename, typename> + friend class co_composed_state_return_overload; + + std::variant<std::monostate, + typename co_composed_state_return_overload< + Executors, Handler, co_composed_returns<Signatures...>, + Signatures>::return_type...> return_value_; +}; + +template <typename Executors, typename Handler, + typename Return, typename... Signatures> +struct co_composed_state_default_cancellation_on_suspend_impl; + +template <typename Executors, typename Handler, typename Return> +struct co_composed_state_default_cancellation_on_suspend_impl< + Executors, Handler, Return> +{ + static constexpr void (*fn())(void*) + { + return nullptr; + } +}; + +template <typename Executors, typename Handler, typename Return, + typename R, typename... Args, typename... Signatures> +struct co_composed_state_default_cancellation_on_suspend_impl< + Executors, Handler, Return, R(Args...), Signatures...> +{ + static constexpr void (*fn())(void*) + { + return co_composed_state_default_cancellation_on_suspend_impl< + Executors, Handler, Return, Signatures...>::fn(); + } +}; + +template <typename Executors, typename Handler, typename Return, + typename R, typename... Args, typename... Signatures> +struct co_composed_state_default_cancellation_on_suspend_impl<Executors, + Handler, Return, R(boost::system::error_code, Args...), Signatures...> +{ + using promise_type = co_composed_promise<Executors, Handler, Return>; + using return_type = std::tuple<boost::system::error_code, Args...>; + + static constexpr void (*fn())(void*) + { + if constexpr ((is_constructible<Args>::value && ...)) + { + return [](void* p) + { + auto& promise = *static_cast<promise_type*>(p); + + co_composed_handler_base<Executors, Handler, + Return> composed_handler(promise); + + Handler handler(std::move(promise.state().handler_)); + + co_composed_handler_base<Executors, Handler, + Return>(std::move(composed_handler)); + + std::move(handler)( + boost::system::error_code(boost::asio::error::operation_aborted), + Args{}...); + }; + } + else + { + return co_composed_state_default_cancellation_on_suspend_impl< + Executors, Handler, Return, Signatures...>::fn(); + } + } +}; + +template <typename Executors, typename Handler, typename Return, + typename R, typename... Args, typename... Signatures> +struct co_composed_state_default_cancellation_on_suspend_impl<Executors, + Handler, Return, R(std::exception_ptr, Args...), Signatures...> +{ + using promise_type = co_composed_promise<Executors, Handler, Return>; + using return_type = std::tuple<std::exception_ptr, Args...>; + + static constexpr void (*fn())(void*) + { + if constexpr ((is_constructible<Args>::value && ...)) + { + return [](void* p) + { + auto& promise = *static_cast<promise_type*>(p); + + co_composed_handler_base<Executors, Handler, + Return> composed_handler(promise); + + Handler handler(std::move(promise.state().handler_)); + + co_composed_handler_base<Executors, Handler, + Return>(std::move(composed_handler)); + + std::move(handler)( + std::make_exception_ptr( + boost::system::system_error( + boost::asio::error::operation_aborted, "co_await")), + Args{}...); + }; + } + else + { + return co_composed_state_default_cancellation_on_suspend_impl< + Executors, Handler, Return, Signatures...>::fn(); + } + } +}; + +template <typename Executors, typename Handler, typename Return> +struct co_composed_state_default_cancellation_on_suspend; + +template <typename Executors, typename Handler, typename... Signatures> +struct co_composed_state_default_cancellation_on_suspend< + Executors, Handler, co_composed_returns<Signatures...>> + : co_composed_state_default_cancellation_on_suspend_impl<Executors, + Handler, co_composed_returns<Signatures...>, Signatures...> +{ +}; + +template <typename Executors, typename Handler, typename Return> +class co_composed_state_cancellation +{ +public: + using cancellation_slot_type = cancellation_slot; + + cancellation_slot_type get_cancellation_slot() const noexcept + { + return cancellation_state_.slot(); + } + + cancellation_state get_cancellation_state() const noexcept + { + return cancellation_state_; + } + + void reset_cancellation_state() + { + cancellation_state_ = cancellation_state( + (get_associated_cancellation_slot)( + static_cast<co_composed_state<Executors, Handler, Return>*>( + this)->handler())); + } + + template <typename Filter> + void reset_cancellation_state(Filter filter) + { + cancellation_state_ = cancellation_state( + (get_associated_cancellation_slot)( + static_cast<co_composed_state<Executors, Handler, Return>*>( + this)->handler()), filter, filter); + } + + template <typename InFilter, typename OutFilter> + void reset_cancellation_state(InFilter&& in_filter, OutFilter&& out_filter) + { + cancellation_state_ = cancellation_state( + (get_associated_cancellation_slot)( + static_cast<co_composed_state<Executors, Handler, Return>*>( + this)->handler()), + std::forward<InFilter>(in_filter), + std::forward<OutFilter>(out_filter)); + } + + cancellation_type_t cancelled() const noexcept + { + return cancellation_state_.cancelled(); + } + + void clear_cancellation_slot() noexcept + { + cancellation_state_.slot().clear(); + } + + [[nodiscard]] bool throw_if_cancelled() const noexcept + { + return throw_if_cancelled_; + } + + void throw_if_cancelled(bool b) noexcept + { + throw_if_cancelled_ = b; + } + + [[nodiscard]] bool complete_if_cancelled() const noexcept + { + return complete_if_cancelled_; + } + + void complete_if_cancelled(bool b) noexcept + { + complete_if_cancelled_ = b; + } + +private: + template <typename, typename, typename> + friend class co_composed_promise; + template <typename, typename, typename, typename> + friend class co_composed_state_return_overload; + + void cancellation_on_suspend_fn(void (*fn)(void*)) + { + cancellation_on_suspend_fn_ = fn; + } + + void check_for_cancellation_on_transform() + { + if (throw_if_cancelled_ && !!cancelled()) + throw_error(boost::asio::error::operation_aborted, "co_await"); + } + + bool check_for_cancellation_on_suspend( + co_composed_promise<Executors, Handler, Return>& promise) noexcept + { + if (complete_if_cancelled_ && !!cancelled() && cancellation_on_suspend_fn_) + { + promise.state().work_.reset(); + promise.state().on_suspend_->fn_ = cancellation_on_suspend_fn_; + promise.state().on_suspend_->arg_ = &promise; + return false; + } + return true; + } + + cancellation_state cancellation_state_; + void (*cancellation_on_suspend_fn_)(void*) = + co_composed_state_default_cancellation_on_suspend< + Executors, Handler, Return>::fn(); + bool throw_if_cancelled_ = false; + bool complete_if_cancelled_ = true; +}; + +template <typename Executors, typename Handler, typename Return> + requires is_same< + typename associated_cancellation_slot< + Handler, cancellation_slot + >::asio_associated_cancellation_slot_is_unspecialised, + void>::value +class co_composed_state_cancellation<Executors, Handler, Return> +{ +public: + void reset_cancellation_state() + { + } + + template <typename Filter> + void reset_cancellation_state(Filter) + { + } + + template <typename InFilter, typename OutFilter> + void reset_cancellation_state(InFilter&&, OutFilter&&) + { + } + + cancellation_type_t cancelled() const noexcept + { + return cancellation_type::none; + } + + void clear_cancellation_slot() noexcept + { + } + + [[nodiscard]] bool throw_if_cancelled() const noexcept + { + return false; + } + + void throw_if_cancelled(bool) noexcept + { + } + + [[nodiscard]] bool complete_if_cancelled() const noexcept + { + return false; + } + + void complete_if_cancelled(bool) noexcept + { + } + +private: + template <typename, typename, typename> + friend class co_composed_promise; + template <typename, typename, typename, typename> + friend class co_composed_state_return_overload; + + void cancellation_on_suspend_fn(void (*)(void*)) + { + } + + void check_for_cancellation_on_transform() noexcept + { + } + + bool check_for_cancellation_on_suspend( + co_composed_promise<Executors, Handler, Return>&) noexcept + { + return true; + } +}; + +template <typename Executors, typename Handler, typename Return> +class co_composed_state + : public co_composed_state_return<Executors, Handler, Return>, + public co_composed_state_cancellation<Executors, Handler, Return> +{ +public: + using io_executor_type = typename composed_work_guard< + typename composed_work<Executors>::head_type>::executor_type; + + template <typename H> + co_composed_state(composed_io_executors<Executors>&& executors, + H&& h, co_composed_on_suspend& on_suspend) + : work_(std::move(executors)), + handler_(std::forward<H>(h)), + on_suspend_(&on_suspend) + { + this->reset_cancellation_state(enable_terminal_cancellation()); + } + + io_executor_type get_io_executor() const noexcept + { + return work_.head_.get_executor(); + } + + template <typename... Args> + [[nodiscard]] co_composed_completion<Args...> complete(Args&&... args) + requires requires { declval<Handler>()(std::forward<Args>(args)...); } + { + return co_composed_completion<Args...>(std::forward<Args>(args)...); + } + + const Handler& handler() const noexcept + { + return handler_; + } + +private: + template <typename, typename, typename> + friend class co_composed_handler_base; + template <typename, typename, typename> + friend class co_composed_promise; + template <typename, typename, typename, typename> + friend class co_composed_promise_return_overload; + template <typename, typename, typename> + friend class co_composed_state_cancellation; + template <typename, typename, typename, typename> + friend class co_composed_state_return_overload; + template <typename, typename, typename, typename...> + friend struct co_composed_state_default_cancellation_on_suspend_impl; + + composed_work<Executors> work_; + Handler handler_; + co_composed_on_suspend* on_suspend_; +}; + +template <typename Executors, typename Handler, typename Return> +class co_composed_handler_cancellation +{ +public: + using cancellation_slot_type = cancellation_slot; + + cancellation_slot_type get_cancellation_slot() const noexcept + { + return static_cast< + const co_composed_handler_base<Executors, Handler, Return>*>( + this)->promise().state().get_cancellation_slot(); + } +}; + +template <typename Executors, typename Handler, typename Return> + requires is_same< + typename associated_cancellation_slot< + Handler, cancellation_slot + >::asio_associated_cancellation_slot_is_unspecialised, + void>::value +class co_composed_handler_cancellation<Executors, Handler, Return> +{ +}; + +template <typename Executors, typename Handler, typename Return> +class co_composed_handler_base : + public co_composed_handler_cancellation<Executors, Handler, Return> +{ +public: + co_composed_handler_base( + co_composed_promise<Executors, Handler, Return>& p) noexcept + : p_(&p) + { + } + + co_composed_handler_base(co_composed_handler_base&& other) noexcept + : p_(std::exchange(other.p_, nullptr)) + { + } + + ~co_composed_handler_base() + { + if (p_) [[unlikely]] + p_->destroy(); + } + + co_composed_promise<Executors, Handler, Return>& promise() const noexcept + { + return *p_; + } + +protected: + void resume(void* result) + { + co_composed_on_suspend on_suspend{}; + std::exchange(p_, nullptr)->resume(p_, result, on_suspend); + if (on_suspend.fn_) + on_suspend.fn_(on_suspend.arg_); + } + +private: + co_composed_promise<Executors, Handler, Return>* p_; +}; + +template <typename Executors, typename Handler, + typename Return, typename Signature> +class co_composed_handler; + +template <typename Executors, typename Handler, + typename Return, typename R, typename... Args> +class co_composed_handler<Executors, Handler, Return, R(Args...)> + : public co_composed_handler_base<Executors, Handler, Return> +{ +public: + using co_composed_handler_base<Executors, + Handler, Return>::co_composed_handler_base; + + using result_type = std::tuple<typename decay<Args>::type...>; + + template <typename... T> + void operator()(T&&... args) + { + result_type result(std::forward<T>(args)...); + this->resume(&result); + } + + static auto on_resume(void* result) + { + auto& args = *static_cast<result_type*>(result); + if constexpr (sizeof...(Args) == 0) + return; + else if constexpr (sizeof...(Args) == 1) + return std::move(std::get<0>(args)); + else + return std::move(args); + } +}; + +template <typename Executors, typename Handler, + typename Return, typename R, typename... Args> +class co_composed_handler<Executors, Handler, + Return, R(boost::system::error_code, Args...)> + : public co_composed_handler_base<Executors, Handler, Return> +{ +public: + using co_composed_handler_base<Executors, + Handler, Return>::co_composed_handler_base; + + using args_type = std::tuple<typename decay<Args>::type...>; + using result_type = std::tuple<boost::system::error_code, args_type>; + + template <typename... T> + void operator()(const boost::system::error_code& ec, T&&... args) + { + result_type result(ec, args_type(std::forward<T>(args)...)); + this->resume(&result); + } + + static auto on_resume(void* result) + { + auto& [ec, args] = *static_cast<result_type*>(result); + throw_error(ec); + if constexpr (sizeof...(Args) == 0) + return; + else if constexpr (sizeof...(Args) == 1) + return std::move(std::get<0>(args)); + else + return std::move(args); + } +}; + +template <typename Executors, typename Handler, + typename Return, typename R, typename... Args> +class co_composed_handler<Executors, Handler, + Return, R(std::exception_ptr, Args...)> + : public co_composed_handler_base<Executors, Handler, Return> +{ +public: + using co_composed_handler_base<Executors, + Handler, Return>::co_composed_handler_base; + + using args_type = std::tuple<typename decay<Args>::type...>; + using result_type = std::tuple<std::exception_ptr, args_type>; + + template <typename... T> + void operator()(std::exception_ptr ex, T&&... args) + { + result_type result(std::move(ex), args_type(std::forward<T>(args)...)); + this->resume(&result); + } + + static auto on_resume(void* result) + { + auto& [ex, args] = *static_cast<result_type*>(result); + if (ex) + std::rethrow_exception(ex); + if constexpr (sizeof...(Args) == 0) + return; + else if constexpr (sizeof...(Args) == 1) + return std::move(std::get<0>(args)); + else + return std::move(args); + } +}; + +template <typename Executors, typename Handler, typename Return> +class co_composed_promise_return; + +template <typename Executors, typename Handler> +class co_composed_promise_return<Executors, Handler, co_composed_returns<>> +{ +public: + auto final_suspend() noexcept + { + return suspend_never(); + } + + void return_void() noexcept + { + } +}; + +template <typename Executors, typename Handler, + typename Return, typename Signature> +class co_composed_promise_return_overload; + +template <typename Executors, typename Handler, + typename Return, typename R, typename... Args> +class co_composed_promise_return_overload< + Executors, Handler, Return, R(Args...)> +{ +public: + using derived_type = co_composed_promise<Executors, Handler, Return>; + using return_type = std::tuple<Args...>; + + void return_value(std::tuple<Args...>&& value) + { + derived_type& promise = *static_cast<derived_type*>(this); + promise.state().return_value_ = std::move(value); + promise.state().work_.reset(); + promise.state().on_suspend_->arg_ = this; + promise.state().on_suspend_->fn_ = + [](void* p) + { + auto& promise = *static_cast<derived_type*>(p); + + co_composed_handler_base<Executors, Handler, + Return> composed_handler(promise); + + Handler handler(std::move(promise.state().handler_)); + return_type result( + std::move(std::get<return_type>(promise.state().return_value_))); + + co_composed_handler_base<Executors, Handler, + Return>(std::move(composed_handler)); + + std::apply(std::move(handler), std::move(result)); + }; + } +}; + +template <typename Executors, typename Handler, typename... Signatures> +class co_composed_promise_return<Executors, + Handler, co_composed_returns<Signatures...>> + : public co_composed_promise_return_overload<Executors, + Handler, co_composed_returns<Signatures...>, Signatures>... +{ +public: + auto final_suspend() noexcept + { + return suspend_always(); + } + + using co_composed_promise_return_overload<Executors, Handler, + co_composed_returns<Signatures...>, Signatures>::return_value...; + +private: + template <typename, typename, typename, typename> + friend class co_composed_promise_return_overload; +}; + +template <typename Executors, typename Handler, typename Return> +class co_composed_promise + : public co_composed_promise_return<Executors, Handler, Return> +{ +public: + template <typename... Args> + void* operator new(std::size_t size, + co_composed_state<Executors, Handler, Return>& state, Args&&...) + { + block_allocator_type allocator( + (get_associated_allocator)(state.handler_, + recycling_allocator<void>())); + + block* base_ptr = std::allocator_traits<block_allocator_type>::allocate( + allocator, blocks(sizeof(allocator_type)) + blocks(size)); + + new (static_cast<void*>(base_ptr)) allocator_type(std::move(allocator)); + + return base_ptr + blocks(sizeof(allocator_type)); + } + + template <typename C, typename... Args> + void* operator new(std::size_t size, C&&, + co_composed_state<Executors, Handler, Return>& state, Args&&...) + { + return co_composed_promise::operator new(size, state); + } + + void operator delete(void* ptr, std::size_t size) + { + block* base_ptr = static_cast<block*>(ptr) - blocks(sizeof(allocator_type)); + + allocator_type* allocator_ptr = std::launder( + static_cast<allocator_type*>(static_cast<void*>(base_ptr))); + + block_allocator_type block_allocator(std::move(*allocator_ptr)); + allocator_ptr->~allocator_type(); + + std::allocator_traits<block_allocator_type>::deallocate(block_allocator, + base_ptr, blocks(sizeof(allocator_type)) + blocks(size)); + } + + template <typename... Args> + co_composed_promise( + co_composed_state<Executors, Handler, Return>& state, Args&&...) + : state_(state) + { + } + + template <typename C, typename... Args> + co_composed_promise(C&&, + co_composed_state<Executors, Handler, Return>& state, Args&&...) + : state_(state) + { + } + + void destroy() noexcept + { + coroutine_handle<co_composed_promise>::from_promise(*this).destroy(); + } + + void resume(co_composed_promise*& owner, void* result, + co_composed_on_suspend& on_suspend) + { + state_.on_suspend_ = &on_suspend; + state_.clear_cancellation_slot(); + owner_ = &owner; + result_ = result; + coroutine_handle<co_composed_promise>::from_promise(*this).resume(); + } + + co_composed_state<Executors, Handler, Return>& state() noexcept + { + return state_; + } + + void get_return_object() noexcept + { + } + + auto initial_suspend() noexcept + { + return suspend_never(); + } + + void unhandled_exception() + { + if (owner_) + *owner_ = this; + throw; + } + + template <async_operation Op> + auto await_transform(Op&& op) + { + class [[nodiscard]] awaitable + { + public: + awaitable(Op&& op, co_composed_promise& promise) + : op_(std::forward<Op>(op)), + promise_(promise) + { + } + + constexpr bool await_ready() const noexcept + { + return false; + } + + void await_suspend(coroutine_handle<co_composed_promise>) + { + if (promise_.state_.check_for_cancellation_on_suspend(promise_)) + { + promise_.state_.on_suspend_->arg_ = this; + promise_.state_.on_suspend_->fn_ = + [](void* p) + { + std::forward<Op>(static_cast<awaitable*>(p)->op_)( + co_composed_handler<Executors, Handler, + Return, completion_signature_of_t<Op>>( + static_cast<awaitable*>(p)->promise_)); + }; + } + } + + auto await_resume() + { + return co_composed_handler<Executors, Handler, Return, + completion_signature_of_t<Op>>::on_resume(promise_.result_); + } + + private: + Op&& op_; + co_composed_promise& promise_; + }; + + state_.check_for_cancellation_on_transform(); + return awaitable{std::forward<Op>(op), *this}; + } + + template <typename... Args> + auto yield_value(co_composed_completion<Args...>&& result) + { + class [[nodiscard]] awaitable + { + public: + awaitable(co_composed_completion<Args...>&& result, + co_composed_promise& promise) + : result_(std::move(result)), + promise_(promise) + { + } + + constexpr bool await_ready() const noexcept + { + return false; + } + + void await_suspend(coroutine_handle<co_composed_promise>) + { + promise_.state_.work_.reset(); + promise_.state_.on_suspend_->arg_ = this; + promise_.state_.on_suspend_->fn_ = + [](void* p) + { + awaitable& a = *static_cast<awaitable*>(p); + + co_composed_handler_base<Executors, Handler, + Return> composed_handler(a.promise_); + + Handler handler(std::move(a.promise_.state_.handler_)); + std::tuple<typename decay<Args>::type...> result( + std::move(static_cast<std::tuple<Args&&...>>(a.result_))); + + co_composed_handler_base<Executors, Handler, + Return>(std::move(composed_handler)); + + std::apply(std::move(handler), std::move(result)); + }; + } + + void await_resume() noexcept + { + } + + private: + co_composed_completion<Args...> result_; + co_composed_promise& promise_; + }; + + return awaitable{std::move(result), *this}; + } + +private: + using allocator_type = + associated_allocator_t<Handler, recycling_allocator<void>>; + + union block + { + std::max_align_t max_align; + alignas(allocator_type) char pad[alignof(allocator_type)]; + }; + + using block_allocator_type = + typename std::allocator_traits<allocator_type> + ::template rebind_alloc<block>; + + static constexpr std::size_t blocks(std::size_t size) + { + return (size + sizeof(block) - 1) / sizeof(block); + } + + co_composed_state<Executors, Handler, Return>& state_; + co_composed_promise** owner_ = nullptr; + void* result_ = nullptr; +}; + +template <typename Implementation, typename Executors, typename... Signatures> +class initiate_co_composed +{ +public: + using executor_type = typename composed_io_executors<Executors>::head_type; + + template <typename I> + initiate_co_composed(I&& impl, composed_io_executors<Executors>&& executors) + : implementation_(std::forward<I>(impl)), + executors_(std::move(executors)) + { + } + + executor_type get_executor() const noexcept + { + return executors_.head_; + } + + template <typename Handler, typename... InitArgs> + void operator()(Handler&& handler, InitArgs&&... init_args) const & + { + using handler_type = typename decay<Handler>::type; + using returns_type = co_composed_returns<Signatures...>; + co_composed_on_suspend on_suspend{}; + implementation_( + co_composed_state<Executors, handler_type, returns_type>( + executors_, std::forward<Handler>(handler), on_suspend), + std::forward<InitArgs>(init_args)...); + if (on_suspend.fn_) + on_suspend.fn_(on_suspend.arg_); + } + + template <typename Handler, typename... InitArgs> + void operator()(Handler&& handler, InitArgs&&... init_args) && + { + using handler_type = typename decay<Handler>::type; + using returns_type = co_composed_returns<Signatures...>; + co_composed_on_suspend on_suspend{}; + std::move(implementation_)( + co_composed_state<Executors, handler_type, returns_type>( + std::move(executors_), std::forward<Handler>(handler), on_suspend), + std::forward<InitArgs>(init_args)...); + if (on_suspend.fn_) + on_suspend.fn_(on_suspend.arg_); + } + +private: + Implementation implementation_; + composed_io_executors<Executors> executors_; +}; + +template <typename... Signatures, typename Implementation, typename Executors> +inline initiate_co_composed<Implementation, Executors, Signatures...> +make_initiate_co_composed(Implementation&& implementation, + composed_io_executors<Executors>&& executors) +{ + return initiate_co_composed< + typename decay<Implementation>::type, Executors, Signatures...>( + std::forward<Implementation>(implementation), std::move(executors)); +} + +} // namespace detail + +template <completion_signature... Signatures, + typename Implementation, typename... IoObjectsOrExecutors> +inline auto co_composed(Implementation&& implementation, + IoObjectsOrExecutors&&... io_objects_or_executors) +{ + return detail::make_initiate_co_composed<Signatures...>( + std::forward<Implementation>(implementation), + detail::make_composed_io_executors( + detail::get_composed_io_executor( + std::forward<IoObjectsOrExecutors>( + io_objects_or_executors))...)); +} + +} // namespace experimental + +#if !defined(GENERATING_DOCUMENTATION) + +template <template <typename, typename> class Associator, + typename Executors, typename Handler, typename Return, + typename Signature, typename DefaultCandidate> +struct associator<Associator, + experimental::detail::co_composed_handler< + Executors, Handler, Return, Signature>, + DefaultCandidate> + : Associator<Handler, DefaultCandidate> +{ + static typename Associator<Handler, DefaultCandidate>::type + get(const experimental::detail::co_composed_handler< + Executors, Handler, Return, Signature>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get( + h.promise().state().handler()); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const experimental::detail::co_composed_handler< + Executors, Handler, Return, Signature>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get( + h.promise().state().handler(), c))) + { + return Associator<Handler, DefaultCandidate>::get( + h.promise().state().handler(), c); + } +}; + +#endif // !defined(GENERATING_DOCUMENTATION) + +} // namespace asio +} // namespace boost + +#if !defined(GENERATING_DOCUMENTATION) +# if defined(BOOST_ASIO_HAS_STD_COROUTINE) +namespace std { +# else // defined(BOOST_ASIO_HAS_STD_COROUTINE) +namespace std { namespace experimental { +# endif // defined(BOOST_ASIO_HAS_STD_COROUTINE) + +template <typename C, typename Executors, + typename Handler, typename Return, typename... Args> +struct coroutine_traits<void, C&, + boost::asio::experimental::detail::co_composed_state< + Executors, Handler, Return>, + Args...> +{ + using promise_type = + boost::asio::experimental::detail::co_composed_promise< + Executors, Handler, Return>; +}; + +template <typename C, typename Executors, + typename Handler, typename Return, typename... Args> +struct coroutine_traits<void, C&&, + boost::asio::experimental::detail::co_composed_state< + Executors, Handler, Return>, + Args...> +{ + using promise_type = + boost::asio::experimental::detail::co_composed_promise< + Executors, Handler, Return>; +}; + +template <typename Executors, typename Handler, + typename Return, typename... Args> +struct coroutine_traits<void, + boost::asio::experimental::detail::co_composed_state< + Executors, Handler, Return>, + Args...> +{ + using promise_type = + boost::asio::experimental::detail::co_composed_promise< + Executors, Handler, Return>; +}; + +# if defined(BOOST_ASIO_HAS_STD_COROUTINE) +} // namespace std +# else // defined(BOOST_ASIO_HAS_STD_COROUTINE) +}} // namespace std::experimental +# endif // defined(BOOST_ASIO_HAS_STD_COROUTINE) +#endif // !defined(GENERATING_DOCUMENTATION) + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_IMPL_EXPERIMENTAL_CO_COMPOSED_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/coro.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/coro.hpp index 87cc035ef7..d769ba72bb 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/coro.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/coro.hpp @@ -17,14 +17,19 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> - +#include <boost/asio/append.hpp> +#include <boost/asio/associated_cancellation_slot.hpp> +#include <boost/asio/bind_allocator.hpp> +#include <boost/asio/deferred.hpp> +#include <boost/asio/experimental/detail/coro_completion_handler.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace experimental { -template <typename Yield, typename Return, typename Executor> +template <typename Yield, typename Return, + typename Executor, typename Allocator> struct coro; namespace detail { @@ -66,7 +71,8 @@ struct coro_cancellation_source } }; -template <typename Signature, typename Return, typename Executor> +template <typename Signature, typename Return, + typename Executor, typename Allocator> struct coro_promise; template <typename T> @@ -160,13 +166,13 @@ struct coro_with_arg constexpr static bool await_ready() { return false; } - template <typename Y, typename R, typename E> - auto await_suspend(coroutine_handle<coro_promise<Y, R, E>> h) + template <typename Y, typename R, typename E, typename A> + auto await_suspend(coroutine_handle<coro_promise<Y, R, E, A>> h) -> coroutine_handle<> { auto& hp = h.promise(); - if constexpr (!coro_promise<Y, R, E>::is_noexcept) + if constexpr (!coro_promise<Y, R, E, A>::is_noexcept) { if ((hp.cancel->state.cancelled() != cancellation_type::none) && hp.cancel->throw_if_cancelled_) @@ -190,7 +196,7 @@ struct coro_with_arg dispatch_coroutine( boost::asio::prefer(hp.get_executor(), execution::outstanding_work.tracked), - [h]() mutable { h.resume(); }); + [h]() mutable { h.resume(); }).handle; coro.coro_->reset_error(); coro.coro_->input_ = std::move(value); @@ -231,7 +237,7 @@ struct coro_with_arg typename coro_t::promise_type>::from_promise(*coro.coro_); return dispatch_coroutine( - coro.coro_->get_executor(), [hh]() mutable { hh.resume(); }); + coro.coro_->get_executor(), [hh]() mutable { hh.resume(); }).handle; } } @@ -567,9 +573,10 @@ struct coro_promise_exchange<Yield, void, void> : coro_awaited_from } }; -template <typename Yield, typename Return, typename Executor> +template <typename Yield, typename Return, + typename Executor, typename Allocator> struct coro_promise final : - coro_promise_allocator<coro<Yield, Return, Executor>>, + coro_promise_allocator<Allocator>, coro_promise_error<coro_traits<Yield, Return, Executor>::is_noexcept>, coro_promise_exchange< typename coro_traits<Yield, Return, Executor>::yield_type, @@ -590,6 +597,13 @@ struct coro_promise final : std::optional<coro_cancellation_source> cancel_source; coro_cancellation_source * cancel; + using cancellation_slot_type = boost::asio::cancellation_slot; + + cancellation_slot_type get_cancellation_slot() const noexcept + { + return cancel ? cancel->slot : cancellation_slot_type{}; + } + using allocator_type = typename std::allocator_traits<associated_allocator_t<Executor>>:: template rebind_alloc<std::byte>; @@ -613,32 +627,40 @@ struct coro_promise final : } template <typename... Args> - coro_promise(Executor executor, Args&&...) noexcept - : executor_(std::move(executor)) + coro_promise(Executor executor, Args&&... args) noexcept + : coro_promise_allocator<Allocator>( + executor, std::forward<Args>(args)...), + executor_(std::move(executor)) { } template <typename First, typename... Args> - coro_promise(First&&, Executor executor, Args&&...) noexcept - : executor_(std::move(executor)) + coro_promise(First&& f, Executor executor, Args&&... args) noexcept + : coro_promise_allocator<Allocator>( + f, executor, std::forward<Args>(args)...), + executor_(std::move(executor)) { } template <typename First, detail::execution_context Context, typename... Args> - coro_promise(First&&, Context&& ctx, Args&&...) noexcept - : executor_(ctx.get_executor()) + coro_promise(First&& f, Context&& ctx, Args&&... args) noexcept + : coro_promise_allocator<Allocator>( + f, ctx, std::forward<Args>(args)...), + executor_(ctx.get_executor()) { } template <detail::execution_context Context, typename... Args> - coro_promise(Context&& ctx, Args&&...) noexcept - : executor_(ctx.get_executor()) + coro_promise(Context&& ctx, Args&&... args) noexcept + : coro_promise_allocator<Allocator>( + ctx, std::forward<Args>(args)...), + executor_(ctx.get_executor()) { } auto get_return_object() { - return coro<Yield, Return, Executor>{this}; + return coro<Yield, Return, Executor, Allocator>{this}; } auto initial_suspend() noexcept @@ -862,48 +884,81 @@ struct coro_promise final : } template <typename T_> - requires requires(T_ t) {{ t.async_wait(use_coro) }; } + requires requires(T_ t) {{ t.async_wait(deferred) }; } auto await_transform(T_& t) -> decltype(auto) { - return await_transform(t.async_wait(use_coro)); + return await_transform(t.async_wait(deferred)); } - template <typename... Ts> - auto await_transform(coro_init_handler<Executor, Ts...>&& kr) const + template <typename Op> + auto await_transform(Op&& op, + typename constraint<is_async_operation<Op>::value>::type = 0) { - assert(cancel); - if constexpr (is_noexcept) - return std::move(kr).as_noexcept(cancel->state.slot()); - else + if ((cancel->state.cancelled() != cancellation_type::none) + && cancel->throw_if_cancelled_) { - if ((cancel->state.cancelled() != cancellation_type::none) - && cancel->throw_if_cancelled_) + boost::asio::detail::throw_error( + boost::asio::error::operation_aborted, "coro-cancelled"); + } + using signature = typename completion_signature_of<Op>::type; + using result_type = detail::coro_completion_handler_type_t<signature>; + using handler_type = + typename detail::coro_completion_handler_type<signature>::template + completion_handler<coro_promise>; + + struct aw_t + { + Op op; + std::optional<result_type> result; + + constexpr static bool await_ready() { - boost::asio::detail::throw_error( - boost::asio::error::operation_aborted, "coro-cancelled"); + return false; } - return std::move(kr).as_throwing(cancel->state.slot()); - } + + void await_suspend(coroutine_handle<coro_promise> h) + { + std::move(op)(handler_type{h, result}); + } + + auto await_resume() + { + if constexpr (is_noexcept) + { + if constexpr (std::tuple_size_v<result_type> == 0u) + return; + else if constexpr (std::tuple_size_v<result_type> == 1u) + return std::get<0>(std::move(result).value()); + else + return std::move(result).value(); + } + else + return detail::coro_interpret_result(std::move(result).value()); + } + }; + + return aw_t{std::move(op), {}}; } }; } // namespace detail -template <typename Yield, typename Return, typename Executor> -struct coro<Yield, Return, Executor>::awaitable_t +template <typename Yield, typename Return, + typename Executor, typename Allocator> +struct coro<Yield, Return, Executor, Allocator>::awaitable_t { coro& coro_; constexpr static bool await_ready() { return false; } - template <typename Y, typename R, typename E> + template <typename Y, typename R, typename E, typename A> auto await_suspend( - detail::coroutine_handle<detail::coro_promise<Y, R, E>> h) + detail::coroutine_handle<detail::coro_promise<Y, R, E, A>> h) -> detail::coroutine_handle<> { auto& hp = h.promise(); - if constexpr (!detail::coro_promise<Y, R, E>::is_noexcept) + if constexpr (!detail::coro_promise<Y, R, E, A>::is_noexcept) { if ((hp.cancel->state.cancelled() != cancellation_type::none) && hp.cancel->throw_if_cancelled_) @@ -929,7 +984,7 @@ struct coro<Yield, Return, Executor>::awaitable_t [h]() mutable { h.resume(); - }); + }).handle; coro_.coro_->reset_error(); @@ -966,12 +1021,12 @@ struct coro<Yield, Return, Executor>::awaitable_t } auto hh = detail::coroutine_handle< - detail::coro_promise<Yield, Return, Executor>>::from_promise( + detail::coro_promise<Yield, Return, Executor, Allocator>>::from_promise( *coro_.coro_); return detail::dispatch_coroutine( coro_.coro_->get_executor(), - [hh]() mutable { hh.resume(); }); + [hh]() mutable { hh.resume(); }).handle; } } @@ -984,10 +1039,13 @@ struct coro<Yield, Return, Executor>::awaitable_t } }; -template <typename Yield, typename Return, typename Executor> -struct coro<Yield, Return, Executor>::initiate_async_resume +template <typename Yield, typename Return, + typename Executor, typename Allocator> +struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume { typedef Executor executor_type; + typedef Allocator allocator_type; + typedef boost::asio::cancellation_slot cancellation_slot_type; explicit initiate_async_resume(coro* self) : coro_(self->coro_) @@ -999,6 +1057,11 @@ struct coro<Yield, Return, Executor>::initiate_async_resume return coro_->get_executor(); } + allocator_type get_allocator() const noexcept + { + return coro_->get_allocator(); + } + template <typename E, typename WaitHandler> auto handle(E exec, WaitHandler&& handler, std::true_type /* error is noexcept */, @@ -1034,11 +1097,8 @@ struct coro<Yield, Return, Executor>::initiate_async_resume auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro); assert(ch && !ch.done()); - coro->awaited_from = detail::post_coroutine(exec, - [coro, h = std::move(h)]() mutable - { - std::move(h)(std::move(coro->result_)); - }); + coro->awaited_from = detail::post_coroutine( + exec, std::move(h), coro->result_).handle; coro->reset_error(); ch.resume(); }; @@ -1054,40 +1114,23 @@ struct coro<Yield, Return, Executor>::initiate_async_resume exec = std::move(exec)]() mutable { if (!coro) - { - boost::asio::post(exec, - [h = std::move(h)]() mutable - { - h(detail::coro_error<error_type>::invalid()); - }); - return; - } + return boost::asio::post(exec, + boost::asio::append(std::move(h), + detail::coro_error<error_type>::invalid())); auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro); if (!ch) - { - boost::asio::post(exec, - [h = std::move(h)]() mutable - { - h(detail::coro_error<error_type>::invalid()); - }); - } + return boost::asio::post(exec, + boost::asio::append(std::move(h), + detail::coro_error<error_type>::invalid())); else if (ch.done()) - { - boost::asio::post(exec, - [h = std::move(h)]() mutable - { - h(detail::coro_error<error_type>::done()); - }); - } + return boost::asio::post(exec, + boost::asio::append(std::move(h), + detail::coro_error<error_type>::done())); else { - coro->awaited_from = - detail::post_coroutine(exec, - [coro, h = std::move(h)]() mutable - { - std::move(h)(std::move(coro->error_)); - }); + coro->awaited_from = detail::post_coroutine( + exec, std::move(h), coro->error_).handle; coro->reset_error(); ch.resume(); } @@ -1104,43 +1147,24 @@ struct coro<Yield, Return, Executor>::initiate_async_resume exec = std::move(exec)]() mutable { if (!coro) - { - boost::asio::post(exec, - [h = std::move(h)]() mutable - { - h(detail::coro_error<error_type>::invalid(), result_type{}); - }); - return; - } + return boost::asio::post(exec, + boost::asio::append(std::move(h), + detail::coro_error<error_type>::invalid(), result_type{})); auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro); if (!ch) - { - boost::asio::post(exec, - [h = std::move(h)]() mutable - { - h(detail::coro_error<error_type>::invalid(), result_type{}); - }); - } + return boost::asio::post(exec, + boost::asio::append(std::move(h), + detail::coro_error<error_type>::invalid(), result_type{})); else if (ch.done()) - { - boost::asio::post(exec, - [h = std::move(h)]() mutable - { - h(detail::coro_error<error_type>::done(), result_type{}); - }); - } + return boost::asio::post(exec, + boost::asio::append(std::move(h), + detail::coro_error<error_type>::done(), result_type{})); else { - coro->awaited_from = - detail::post_coroutine(exec, - [h = std::move(h), coro]() mutable - { - std::move(h)( - std::move(coro->error_), - std::move(coro->result_)); - }); + coro->awaited_from = detail::post_coroutine( + exec, std::move(h), coro->error_, coro->result_).handle; coro->reset_error(); ch.resume(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/parallel_group.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/parallel_group.hpp index 2888f78bfe..a22b0ac612 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/parallel_group.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/parallel_group.hpp @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <atomic> +#include <deque> #include <memory> #include <new> #include <tuple> @@ -393,6 +394,342 @@ void parallel_group_launch(Condition cancellation_condition, Handler handler, Condition, Handler, Ops...> >(state); } +// Proxy completion handler for the ranged group of parallel operatations. +// Unpacks and recombines the individual operations' results, and invokes the +// user's completion handler. +template <typename Handler, typename Op, typename Allocator> +struct ranged_parallel_group_completion_handler +{ + typedef typename decay< + typename prefer_result< + typename associated_executor<Handler>::type, + execution::outstanding_work_t::tracked_t + >::type + >::type executor_type; + + typedef typename parallel_op_signature_as_tuple< + typename completion_signature_of<Op>::type + >::type op_tuple_type; + + typedef parallel_group_op_result<op_tuple_type> op_result_type; + + ranged_parallel_group_completion_handler(Handler&& h, + std::size_t size, const Allocator& allocator) + : handler_(std::move(h)), + executor_( + boost::asio::prefer( + boost::asio::get_associated_executor(handler_), + execution::outstanding_work.tracked)), + allocator_(allocator), + completion_order_(size, 0, + BOOST_ASIO_REBIND_ALLOC(Allocator, std::size_t)(allocator)), + args_(BOOST_ASIO_REBIND_ALLOC(Allocator, op_result_type)(allocator)) + { + for (std::size_t i = 0; i < size; ++i) + args_.emplace_back(); + } + + executor_type get_executor() const noexcept + { + return executor_; + } + + void operator()() + { + this->invoke( + boost::asio::detail::make_index_sequence< + std::tuple_size<op_tuple_type>::value>()); + } + + template <std::size_t... I> + void invoke(boost::asio::detail::index_sequence<I...>) + { + typedef typename parallel_op_signature_as_tuple< + typename ranged_parallel_group_signature< + typename completion_signature_of<Op>::type, + Allocator + >::raw_type + >::type vectors_type; + + // Construct all result vectors using the supplied allocator. + vectors_type vectors{ + typename std::tuple_element<I, vectors_type>::type( + BOOST_ASIO_REBIND_ALLOC(Allocator, int)(allocator_))...}; + + // Reserve sufficient space in each of the result vectors. + int reserve_fold[] = { 0, + ( std::get<I>(vectors).reserve(completion_order_.size()), + 0 )... + }; + (void)reserve_fold; + + // Copy the results from all operations into the result vectors. + for (std::size_t idx = 0; idx < completion_order_.size(); ++idx) + { + int pushback_fold[] = { 0, + ( std::get<I>(vectors).push_back( + std::move(std::get<I>(args_[idx].get()))), + 0 )... + }; + (void)pushback_fold; + } + + std::move(handler_)(completion_order_, std::move(std::get<I>(vectors))...); + } + + Handler handler_; + executor_type executor_; + Allocator allocator_; + std::vector<std::size_t, + BOOST_ASIO_REBIND_ALLOC(Allocator, std::size_t)> completion_order_; + std::deque<op_result_type, + BOOST_ASIO_REBIND_ALLOC(Allocator, op_result_type)> args_; +}; + +// Shared state for the parallel group. +template <typename Condition, typename Handler, typename Op, typename Allocator> +struct ranged_parallel_group_state +{ + ranged_parallel_group_state(Condition&& c, Handler&& h, + std::size_t size, const Allocator& allocator) + : cancellations_requested_(size), + outstanding_(size), + cancellation_signals_( + BOOST_ASIO_REBIND_ALLOC(Allocator, + boost::asio::cancellation_signal)(allocator)), + cancellation_condition_(std::move(c)), + handler_(std::move(h), size, allocator) + { + for (std::size_t i = 0; i < size; ++i) + cancellation_signals_.emplace_back(); + } + + // The number of operations that have completed so far. Used to determine the + // order of completion. + std::atomic<unsigned int> completed_{0}; + + // The non-none cancellation type that resulted from a cancellation condition. + // Stored here for use by the group's initiating function. + std::atomic<cancellation_type_t> cancel_type_{cancellation_type::none}; + + // The number of cancellations that have been requested, either on completion + // of the operations within the group, or via the cancellation slot for the + // group operation. Initially set to the number of operations to prevent + // cancellation signals from being emitted until after all of the group's + // operations' initiating functions have completed. + std::atomic<unsigned int> cancellations_requested_; + + // The number of operations that are yet to complete. Used to determine when + // it is safe to invoke the user's completion handler. + std::atomic<unsigned int> outstanding_; + + // The cancellation signals for each operation in the group. + std::deque<boost::asio::cancellation_signal, + BOOST_ASIO_REBIND_ALLOC(Allocator, boost::asio::cancellation_signal)> + cancellation_signals_; + + // The cancellation condition is used to determine whether the results from an + // individual operation warrant a cancellation request for the whole group. + Condition cancellation_condition_; + + // The proxy handler to be invoked once all operations in the group complete. + ranged_parallel_group_completion_handler<Handler, Op, Allocator> handler_; +}; + +// Handler for an individual operation within the parallel group. +template <typename Condition, typename Handler, typename Op, typename Allocator> +struct ranged_parallel_group_op_handler +{ + typedef boost::asio::cancellation_slot cancellation_slot_type; + + ranged_parallel_group_op_handler( + std::shared_ptr<ranged_parallel_group_state< + Condition, Handler, Op, Allocator> > state, + std::size_t idx) + : state_(std::move(state)), + idx_(idx) + { + } + + cancellation_slot_type get_cancellation_slot() const noexcept + { + return state_->cancellation_signals_[idx_].slot(); + } + + template <typename... Args> + void operator()(Args... args) + { + // Capture this operation into the completion order. + state_->handler_.completion_order_[state_->completed_++] = idx_; + + // Determine whether the results of this operation require cancellation of + // the whole group. + cancellation_type_t cancel_type = state_->cancellation_condition_(args...); + + // Capture the result of the operation into the proxy completion handler. + state_->handler_.args_[idx_].emplace(std::move(args)...); + + if (cancel_type != cancellation_type::none) + { + // Save the type for potential use by the group's initiating function. + state_->cancel_type_ = cancel_type; + + // If we are the first operation to request cancellation, emit a signal + // for each operation in the group. + if (state_->cancellations_requested_++ == 0) + for (std::size_t i = 0; i < state_->cancellation_signals_.size(); ++i) + if (i != idx_) + state_->cancellation_signals_[i].emit(cancel_type); + } + + // If this is the last outstanding operation, invoke the user's handler. + if (--state_->outstanding_ == 0) + boost::asio::dispatch(std::move(state_->handler_)); + } + + std::shared_ptr<ranged_parallel_group_state< + Condition, Handler, Op, Allocator> > state_; + std::size_t idx_; +}; + +// Handler for an individual operation within the parallel group that has an +// explicitly specified executor. +template <typename Executor, typename Condition, + typename Handler, typename Op, typename Allocator> +struct ranged_parallel_group_op_handler_with_executor : + ranged_parallel_group_op_handler<Condition, Handler, Op, Allocator> +{ + typedef ranged_parallel_group_op_handler< + Condition, Handler, Op, Allocator> base_type; + typedef boost::asio::cancellation_slot cancellation_slot_type; + typedef Executor executor_type; + + ranged_parallel_group_op_handler_with_executor( + std::shared_ptr<ranged_parallel_group_state< + Condition, Handler, Op, Allocator> > state, + executor_type ex, std::size_t idx) + : ranged_parallel_group_op_handler<Condition, Handler, Op, Allocator>( + std::move(state), idx) + { + cancel_proxy_ = + &this->state_->cancellation_signals_[idx].slot().template + emplace<cancel_proxy>(this->state_, std::move(ex)); + } + + cancellation_slot_type get_cancellation_slot() const noexcept + { + return cancel_proxy_->signal_.slot(); + } + + executor_type get_executor() const noexcept + { + return cancel_proxy_->executor_; + } + + // Proxy handler that forwards the emitted signal to the correct executor. + struct cancel_proxy + { + cancel_proxy( + std::shared_ptr<ranged_parallel_group_state< + Condition, Handler, Op, Allocator> > state, + executor_type ex) + : state_(std::move(state)), + executor_(std::move(ex)) + { + } + + void operator()(cancellation_type_t type) + { + if (auto state = state_.lock()) + { + boost::asio::cancellation_signal* sig = &signal_; + boost::asio::dispatch(executor_, + [state, sig, type]{ sig->emit(type); }); + } + } + + std::weak_ptr<ranged_parallel_group_state< + Condition, Handler, Op, Allocator> > state_; + boost::asio::cancellation_signal signal_; + executor_type executor_; + }; + + cancel_proxy* cancel_proxy_; +}; + +template <typename Condition, typename Handler, typename Op, typename Allocator> +struct ranged_parallel_group_cancellation_handler +{ + ranged_parallel_group_cancellation_handler( + std::shared_ptr<ranged_parallel_group_state< + Condition, Handler, Op, Allocator> > state) + : state_(std::move(state)) + { + } + + void operator()(cancellation_type_t cancel_type) + { + // If we are the first place to request cancellation, i.e. no operation has + // yet completed and requested cancellation, emit a signal for each + // operation in the group. + if (cancel_type != cancellation_type::none) + if (auto state = state_.lock()) + if (state->cancellations_requested_++ == 0) + for (std::size_t i = 0; i < state->cancellation_signals_.size(); ++i) + state->cancellation_signals_[i].emit(cancel_type); + } + + std::weak_ptr<ranged_parallel_group_state< + Condition, Handler, Op, Allocator> > state_; +}; + +template <typename Condition, typename Handler, + typename Range, typename Allocator> +void ranged_parallel_group_launch(Condition cancellation_condition, + Handler handler, Range&& range, const Allocator& allocator) +{ + // Get the user's completion handler's cancellation slot, so that we can allow + // cancellation of the entire group. + typename associated_cancellation_slot<Handler>::type slot + = boost::asio::get_associated_cancellation_slot(handler); + + // The type of the asynchronous operation. + typedef typename std::decay<decltype( + *std::declval<typename Range::iterator>())>::type op_type; + + // Create the shared state for the operation. + typedef ranged_parallel_group_state<Condition, + Handler, op_type, Allocator> state_type; + std::shared_ptr<state_type> state = std::allocate_shared<state_type>( + boost::asio::detail::recycling_allocator<state_type, + boost::asio::detail::thread_info_base::parallel_group_tag>(), + std::move(cancellation_condition), + std::move(handler), range.size(), allocator); + + std::size_t idx = 0; + for (auto&& op : std::forward<Range>(range)) + { + typedef typename associated_executor<op_type>::type ex_type; + ex_type ex = boost::asio::get_associated_executor(op); + std::move(op)( + ranged_parallel_group_op_handler_with_executor< + ex_type, Condition, Handler, op_type, Allocator>( + state, std::move(ex), idx++)); + } + + // Check if any of the operations has already requested cancellation, and if + // so, emit a signal for each operation in the group. + if ((state->cancellations_requested_ -= range.size()) > 0) + for (auto& signal : state->cancellation_signals_) + signal.emit(state->cancel_type_); + + // Register a handler with the user's completion handler's cancellation slot. + if (slot.is_connected()) + slot.template emplace< + ranged_parallel_group_cancellation_handler< + Condition, Handler, op_type, Allocator> >(state); +} + } // namespace detail } // namespace experimental @@ -403,10 +740,47 @@ struct associator<Associator, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const experimental::detail::parallel_group_completion_handler< + static typename Associator<Handler, DefaultCandidate>::type + get(const experimental::detail::parallel_group_completion_handler< + Handler, Ops...>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const experimental::detail::parallel_group_completion_handler< Handler, Ops...>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) + { + return Associator<Handler, DefaultCandidate>::get(h.handler_, c); + } +}; + +template <template <typename, typename> class Associator, typename Handler, + typename Op, typename Allocator, typename DefaultCandidate> +struct associator<Associator, + experimental::detail::ranged_parallel_group_completion_handler< + Handler, Op, Allocator>, + DefaultCandidate> + : Associator<Handler, DefaultCandidate> +{ + static typename Associator<Handler, DefaultCandidate>::type + get(const experimental::detail::ranged_parallel_group_completion_handler< + Handler, Op, Allocator>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const experimental::detail::ranged_parallel_group_completion_handler< + Handler, Op, Allocator>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/promise.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/promise.hpp index 0d7dbeab1e..0cab847539 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/promise.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/promise.hpp @@ -15,10 +15,10 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include <boost/asio/detail/config.hpp> #include <boost/asio/cancellation_signal.hpp> -#include <boost/asio/experimental/detail/completion_handler_erasure.hpp> +#include <boost/asio/detail/utility.hpp> #include <tuple> -#include <optional> #include <boost/asio/detail/push_options.hpp> @@ -26,51 +26,171 @@ namespace boost { namespace asio { namespace experimental { -template<typename Signature = void(), typename Executor = any_io_executor> +template<typename Signature = void(), + typename Executor = boost::asio::any_io_executor, + typename Allocator = std::allocator<void>> struct promise; namespace detail { -template<typename Signature, typename Executor> +template<typename Signature, typename Executor, typename Allocator> struct promise_impl; -template<typename ... Ts, typename Executor> -struct promise_impl<void(Ts...), Executor> +template<typename... Ts, typename Executor, typename Allocator> +struct promise_impl<void(Ts...), Executor, Allocator> { using result_type = std::tuple<Ts...>; - promise_impl(Executor executor = {}) - : executor(std::move(executor)) + promise_impl(Allocator allocator, Executor executor) + : allocator(std::move(allocator)), executor(std::move(executor)) { } - std::optional<result_type> result; - bool done{false}; - detail::completion_handler_erasure<void(Ts...), Executor> completion; + promise_impl(const promise_impl&) = delete; + + ~promise_impl() + { + if (completion) + this->cancel_(); + + if (done) + reinterpret_cast<result_type*>(&result)->~result_type(); + } + + typename aligned_storage<sizeof(result_type), + alignof(result_type)>::type result; + std::atomic<bool> done{false}; cancellation_signal cancel; + Allocator allocator; Executor executor; -}; -template<typename Signature = void(), typename Executor = any_io_executor> -struct promise_handler; + template<typename Func, std::size_t... Idx> + void apply_impl(Func f, boost::asio::detail::index_sequence<Idx...>) + { + auto& result_type = *reinterpret_cast<promise_impl::result_type*>(&result); + f(std::get<Idx>(std::move(result_type))...); + } + + using allocator_type = Allocator; + allocator_type get_allocator() {return allocator;} + + using executor_type = Executor; + executor_type get_executor() {return executor;} + + template<typename Func> + void apply(Func f) + { + apply_impl(std::forward<Func>(f), + boost::asio::detail::make_index_sequence<sizeof...(Ts)>{}); + } + + struct completion_base + { + virtual void invoke(Ts&&...ts) = 0; + }; + + template<typename Alloc, typename WaitHandler_> + struct completion_impl final : completion_base + { + WaitHandler_ handler; + Alloc allocator; + void invoke(Ts&&... ts) + { + auto h = std::move(handler); + + using alloc_t = typename std::allocator_traits< + typename boost::asio::decay<Alloc>::type>::template + rebind_alloc<completion_impl>; + + alloc_t alloc_{allocator}; + this->~completion_impl(); + std::allocator_traits<alloc_t>::deallocate(alloc_, this, 1u); + std::move(h)(std::forward<Ts>(ts)...); + } + + template<typename Alloc_, typename Handler_> + completion_impl(Alloc_&& alloc, Handler_&& wh) + : handler(std::forward<Handler_>(wh)), + allocator(std::forward<Alloc_>(alloc)) + { + } + }; + + completion_base* completion = nullptr; + typename boost::asio::aligned_storage<sizeof(void*) * 4, + alignof(completion_base)>::type completion_opt; + + template<typename Alloc, typename Handler> + void set_completion(Alloc&& alloc, Handler&& handler) + { + if (completion) + cancel_(); + + using impl_t = completion_impl< + typename boost::asio::decay<Alloc>::type, Handler>; + using alloc_t = typename std::allocator_traits< + typename boost::asio::decay<Alloc>::type>::template rebind_alloc<impl_t>; + + alloc_t alloc_{alloc}; + auto p = std::allocator_traits<alloc_t>::allocate(alloc_, 1u); + completion = new (p) impl_t(std::forward<Alloc>(alloc), + std::forward<Handler>(handler)); + } + + template<typename... T_> + void complete(T_&&... ts) + { + assert(completion); + std::exchange(completion, nullptr)->invoke(std::forward<T_>(ts)...); + } -template<typename Signature, typename Executor> + template<typename... T_> + void cancel_impl_(std::exception_ptr*, T_*...) + { + complete( + std::make_exception_ptr( + boost::system::system_error( + boost::asio::error::operation_aborted)), + T_{}...); + } + + template<typename... T_> + void cancel_impl_(boost::system::error_code*, T_*...) + { + complete(boost::asio::error::operation_aborted, T_{}...); + } + + template<typename... T_> + void cancel_impl_(T_*...) + { + complete(T_{}...); + } + + void cancel_() + { + cancel_impl_(static_cast<Ts*>(nullptr)...); + } +}; + +template<typename Signature = void(), + typename Executor = boost::asio::any_io_executor, + typename Allocator = any_io_executor> struct promise_handler; -template<typename ... Ts, typename Executor> -struct promise_handler<void(Ts...), Executor> +template<typename... Ts, typename Executor, typename Allocator> +struct promise_handler<void(Ts...), Executor, Allocator> { - using promise_type = promise<void(Ts...), Executor>; + using promise_type = promise<void(Ts...), Executor, Allocator>; - promise_handler(Executor executor) // get_associated_allocator(exec) - : impl_{ - std::allocate_shared<promise_impl<void(Ts...), Executor>>( - get_associated_allocator(executor))} + promise_handler( + Allocator allocator, Executor executor) // get_associated_allocator(exec) + : impl_( + std::allocate_shared<promise_impl<void(Ts...), Executor, Allocator>>( + allocator, allocator, executor)) { - impl_->executor = std::move(executor); } - std::shared_ptr<promise_impl<void(Ts...), Executor>> impl_; + std::shared_ptr<promise_impl<void(Ts...), Executor, Allocator>> impl_; using cancellation_slot_type = cancellation_slot; @@ -79,18 +199,37 @@ struct promise_handler<void(Ts...), Executor> return impl_->cancel.slot(); } - auto make_promise() -> promise<void(Ts...), Executor> + using allocator_type = Allocator; + + allocator_type get_allocator() const noexcept + { + return impl_->get_allocator(); + } + + using executor_type = Executor; + + Executor get_executor() const noexcept { - return {impl_}; + return impl_->get_executor(); + } + + auto make_promise() -> promise<void(Ts...), executor_type, allocator_type> + { + return promise<void(Ts...), executor_type, allocator_type>{impl_}; } void operator()(std::remove_reference_t<Ts>... ts) { assert(impl_); - impl_->result.emplace(std::move(ts)...); + + using result_type = typename promise_impl< + void(Ts...), allocator_type, executor_type>::result_type ; + + new (&impl_->result) result_type(std::move(ts)...); impl_->done = true; - if (auto f = std::exchange(impl_->completion, nullptr); f != nullptr) - std::apply(std::move(f), std::move(*impl_->result)); + + if (impl_->completion) + impl_->complete(std::move(ts)...); } }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/use_coro.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/use_coro.hpp index 5a02f57c31..0e32722225 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/use_coro.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/use_coro.hpp @@ -16,247 +16,193 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include <boost/asio/deferred.hpp> +#include <boost/asio/experimental/coro.hpp> + #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { -namespace experimental { - -template <typename Yield, typename Return, typename Executor> -struct coro; -namespace detail { - -template <typename Yield, typename Return, typename Executor> -struct coro_promise; +#if !defined(GENERATING_DOCUMENTATION) -template <typename Executor, typename... Ts> -struct coro_init_handler +template <typename Allocator, typename R> +struct async_result<experimental::use_coro_t<Allocator>, R()> { - struct handler_t + template <typename Initiation, typename... InitArgs> + static auto initiate_impl(Initiation initiation, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void() noexcept, void, + boost::asio::associated_executor_t<Initiation>, Allocator> { - }; - - constexpr static handler_t handler{}; + co_await deferred_async_operation<R(), Initiation, InitArgs...>( + deferred_init_tag{}, std::move(initiation), std::move(args)...); + } - struct init_helper; + template <typename... InitArgs> + static auto initiate_impl(boost::asio::detail::initiation_archetype<R()>, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void(), void, + boost::asio::any_io_executor, Allocator>; - struct promise_type + template <typename Initiation, typename... InitArgs> + static auto initiate(Initiation initiation, + experimental::use_coro_t<Allocator> tk, InitArgs&&... args) { - auto initial_suspend() noexcept { return suspend_always{}; } - - auto final_suspend() noexcept { return suspend_always(); } - - void return_void() {} - - void unhandled_exception() { assert(false); } - - auto await_transform(handler_t) - { - assert(executor); - assert(h); - return init_helper{this}; - } - - std::optional<Executor> executor; - std::optional<std::tuple<Ts...>> result; - coroutine_handle<> h; - - coro_init_handler get_return_object() { return coro_init_handler{this}; } - - cancellation_slot cancel_slot; - }; + return initiate_impl(std::move(initiation), std::allocator_arg, + tk.get_allocator(), std::forward<InitArgs>(args)...); + } +}; - struct init_helper +template <typename Allocator, typename R> +struct async_result< + experimental::use_coro_t<Allocator>, R(boost::system::error_code)> +{ + template <typename Initiation, typename... InitArgs> + static auto initiate_impl(Initiation initiation, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void() noexcept, void, + boost::asio::associated_executor_t<Initiation>, Allocator> { - promise_type *self_; - - constexpr static bool await_ready() noexcept { return true; } - - constexpr static void await_suspend(coroutine_handle<>) noexcept {} - - auto await_resume() const noexcept - { - assert(self_); - return bind_cancellation_slot(self_->cancel_slot, - bind_executor(*self_->executor, [self = self_](Ts... ts) - { - self->cancel_slot.clear(); - self->result.emplace(std::move(ts)...); - self->h.resume(); - })); - } - }; + co_await deferred_async_operation< + R(boost::system::error_code), Initiation, InitArgs...>( + deferred_init_tag{}, std::move(initiation), std::move(args)...); + } - promise_type* promise; + template <typename... InitArgs> + static auto initiate_impl( + boost::asio::detail::initiation_archetype<R(boost::system::error_code)>, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void(), void, + boost::asio::any_io_executor, Allocator>; - void unhandled_exception() noexcept + template <typename Initiation, typename... InitArgs> + static auto initiate(Initiation initiation, + experimental::use_coro_t<Allocator> tk, InitArgs&&... args) { - throw; + return initiate_impl(std::move(initiation), std::allocator_arg, + tk.get_allocator(), std::forward<InitArgs>(args)...); } +}; - struct noexcept_version +template <typename Allocator, typename R> +struct async_result< + experimental::use_coro_t<Allocator>, R(std::exception_ptr)> +{ + template <typename Initiation, typename... InitArgs> + static auto initiate_impl(Initiation initiation, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void(), void, + boost::asio::associated_executor_t<Initiation>, Allocator> { - promise_type *promise; - - constexpr static bool await_ready() noexcept { return false; } - - template <typename Yield, typename Return, - convertible_to<Executor> Executor1> - auto await_suspend( - coroutine_handle<coro_promise<Yield, Return, Executor1> > h) noexcept - { - promise->executor = h.promise().get_executor(); - promise->h = h; - return coroutine_handle<promise_type>::from_promise(*promise); - } - - template <typename... Args> - static auto resume_impl(std::tuple<Args...>&& tup) - { - return std::move(tup); - } - - template <typename Arg> - static auto resume_impl(std::tuple<Arg>&& tup) - { - return get<0>(std::move(tup)); - } - - static void resume_impl(std::tuple<>&&) {} + co_await deferred_async_operation< + R(boost::system::error_code), Initiation, InitArgs...>( + deferred_init_tag{}, std::move(initiation), std::move(args)...); + } - auto await_resume() const noexcept - { - auto res = std::move(promise->result.value()); - coroutine_handle<promise_type>::from_promise(*promise).destroy(); - return resume_impl(std::move(res)); - } - }; + template <typename... InitArgs> + static auto initiate_impl( + boost::asio::detail::initiation_archetype<R(std::exception_ptr)>, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void(), void, + boost::asio::any_io_executor, Allocator>; - struct throwing_version + template <typename Initiation, typename... InitArgs> + static auto initiate(Initiation initiation, + experimental::use_coro_t<Allocator> tk, InitArgs&&... args) { - promise_type *promise; - - constexpr static bool await_ready() noexcept { return false; } - - template <typename Yield, typename Return, - convertible_to<Executor> Executor1> - auto await_suspend( - coroutine_handle<coro_promise<Yield, Return, Executor1> > h) noexcept - { - promise->executor = h.promise().get_executor(); - promise->h = h; - return coroutine_handle<promise_type>::from_promise(*promise); - } - - template <typename... Args> - static auto resume_impl(std::tuple<Args...>&& tup) - { - return std::move(tup); - } - - static void resume_impl(std::tuple<>&&) {} - - template <typename Arg> - static auto resume_impl(std::tuple<Arg>&& tup) - { - return get<0>(std::move(tup)); - } - - template <typename... Args> - static auto resume_impl(std::tuple<std::exception_ptr, Args...>&& tup) - { - auto ex = get<0>(std::move(tup)); - if (ex) - std::rethrow_exception(ex); - - if constexpr (sizeof...(Args) == 0u) - return; - else if constexpr (sizeof...(Args) == 1u) - return get<1>(std::move(tup)); - else - { - return - [&]<std::size_t... Idx>(std::index_sequence<Idx...>) - { - return std::make_tuple(std::get<Idx + 1>(std::move(tup))...); - }(std::make_index_sequence<sizeof...(Args) - 1>{}); - } - } - - template <typename... Args> - static auto resume_impl( - std::tuple<boost::system::error_code, Args...>&& tup) - { - auto ec = get<0>(std::move(tup)); - if (ec) - boost::asio::detail::throw_exception( - boost::system::system_error(ec, "error_code in use_coro")); - - if constexpr (sizeof...(Args) == 0u) - return; - else if constexpr (sizeof...(Args) == 1u) - return get<1>(std::move(tup)); - else - return - [&]<std::size_t... Idx>(std::index_sequence<Idx...>) - { - return std::make_tuple(std::get<Idx + 1>(std::move(tup))...); - }(std::make_index_sequence<sizeof...(Args) - 1>{}); - } + return initiate_impl(std::move(initiation), std::allocator_arg, + tk.get_allocator(), std::forward<InitArgs>(args)...); + } +}; - static auto resume_impl(std::tuple<std::exception_ptr>&& tup) - { - auto ex = get<0>(std::move(tup)); - if (ex) - std::rethrow_exception(ex); - } +template <typename Allocator, typename R, typename T> +struct async_result<experimental::use_coro_t<Allocator>, R(T)> +{ - static auto resume_impl( - std::tuple<boost::system::error_code>&& tup) - { - auto ec = get<0>(std::move(tup)); - if (ec) - boost::asio::detail::throw_error(ec, "error_code in use_coro"); - } + template <typename Initiation, typename... InitArgs> + static auto initiate_impl(Initiation initiation, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void() noexcept, T, + boost::asio::associated_executor_t<Initiation>, Allocator> + { + co_return co_await deferred_async_operation<R(), Initiation, InitArgs...>( + deferred_init_tag{}, std::move(initiation), std::move(args)...); + } - auto await_resume() const - { - auto res = std::move(promise->result.value()); - coroutine_handle<promise_type>::from_promise(*promise).destroy(); - return resume_impl(std::move(res)); - } - }; + template <typename... InitArgs> + static auto initiate_impl(boost::asio::detail::initiation_archetype<R(T)>, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void() noexcept, T, + boost::asio::any_io_executor, Allocator>; - auto as_noexcept(cancellation_slot&& sl) && noexcept + template <typename Initiation, typename... InitArgs> + static auto initiate(Initiation initiation, + experimental::use_coro_t<Allocator> tk, InitArgs&&... args) { - promise->cancel_slot = std::move(sl); - return noexcept_version{promise}; + return initiate_impl(std::move(initiation), std::allocator_arg, + tk.get_allocator(), std::forward<InitArgs>(args)...); } +}; - auto as_throwing(cancellation_slot&& sl) && noexcept +template <typename Allocator, typename R, typename T> +struct async_result< + experimental::use_coro_t<Allocator>, R(boost::system::error_code, T)> +{ + template <typename Initiation, typename... InitArgs> + static auto initiate_impl(Initiation initiation, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void(), T, + boost::asio::associated_executor_t<Initiation>, Allocator> { - promise->cancel_slot = std::move(sl); - return throwing_version{promise}; + co_return co_await deferred_async_operation< + R(boost::system::error_code), Initiation, InitArgs...>( + deferred_init_tag{}, std::move(initiation), std::move(args)...); } -}; -} // namespace detail -} // namespace experimental + template <typename... InitArgs> + static auto initiate_impl( + boost::asio::detail::initiation_archetype< + R(boost::system::error_code, T)>, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void(), T, boost::asio::any_io_executor, Allocator>; -#if !defined(GENERATING_DOCUMENTATION) + template <typename Initiation, typename... InitArgs> + static auto initiate(Initiation initiation, + experimental::use_coro_t<Allocator> tk, InitArgs&&... args) + { + return initiate_impl(std::move(initiation), std::allocator_arg, + tk.get_allocator(), std::forward<InitArgs>(args)...); + } +}; -template <typename Executor, typename R, typename... Args> -struct async_result<experimental::use_coro_t<Executor>, R(Args...)> +template <typename Allocator, typename R, typename T> +struct async_result< + experimental::use_coro_t<Allocator>, R(std::exception_ptr, T)> { - using return_type = experimental::detail::coro_init_handler< - Executor, typename decay<Args>::type...>; + template <typename Initiation, typename... InitArgs> + static auto initiate_impl(Initiation initiation, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void(), T, + boost::asio::associated_executor_t<Initiation>, Allocator> + { + co_return co_await deferred_async_operation< + R(boost::system::error_code), Initiation, InitArgs...>( + deferred_init_tag{}, std::move(initiation), std::move(args)...); + } + + template <typename... InitArgs> + static auto initiate_impl( + boost::asio::detail::initiation_archetype<R(std::exception_ptr, T)>, + std::allocator_arg_t, Allocator, InitArgs... args) + -> experimental::coro<void(), T, boost::asio::any_io_executor, Allocator>; template <typename Initiation, typename... InitArgs> - static return_type initiate(Initiation initiation, - experimental::use_coro_t<Executor>, InitArgs... args) + static auto initiate(Initiation initiation, + experimental::use_coro_t<Allocator> tk, InitArgs&&... args) { - std::move(initiation)(co_await return_type::handler, std::move(args)...); + return initiate_impl(std::move(initiation), std::allocator_arg, + tk.get_allocator(), std::forward<InitArgs>(args)...); } }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/use_promise.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/use_promise.hpp new file mode 100644 index 0000000000..3b6918e52e --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/impl/use_promise.hpp @@ -0,0 +1,68 @@ +// +// experimental/impl/use_promise.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2021-2022 Klemens D. Morgenstern +// (klemens dot morgenstern at gmx dot net) +// +// 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 BOOST_ASIO_EXPERIMENTAL_IMPL_USE_PROMISE_HPP +#define BOOST_ASIO_EXPERIMENTAL_IMPL_USE_PROMISE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <memory> +#include <boost/asio/async_result.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace experimental { + +template <typename Allocator> +struct use_promise_t; + +namespace detail { + +template<typename Signature, typename Executor, typename Allocator> +struct promise_handler; + +} // namespace detail +} // namespace experimental + +#if !defined(GENERATING_DOCUMENTATION) + +template <typename Allocator, typename R, typename... Args> +struct async_result<experimental::use_promise_t<Allocator>, R(Args...)> +{ + template <typename Initiation, typename... InitArgs> + static auto initiate(Initiation initiation, + experimental::use_promise_t<Allocator> up, InitArgs... args) + -> experimental::promise<void(typename decay<Args>::type...), + boost::asio::associated_executor_t<Initiation>, Allocator> + { + using handler_type = experimental::detail::promise_handler< + void(typename decay<Args>::type...), + boost::asio::associated_executor_t<Initiation>, Allocator>; + + handler_type ht{up.get_allocator(), get_associated_executor(initiation)}; + std::move(initiation)(ht, std::move(args)...); + return ht.make_promise(); + } +}; + +#endif // !defined(GENERATING_DOCUMENTATION) + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_EXPERIMENTAL_IMPL_USE_PROMISE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/parallel_group.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/parallel_group.hpp index 55f50328de..110db8450a 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/parallel_group.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/parallel_group.hpp @@ -16,7 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> +#include <vector> #include <boost/asio/detail/array.hpp> +#include <boost/asio/detail/memory.hpp> #include <boost/asio/detail/utility.hpp> #include <boost/asio/experimental/cancellation_condition.hpp> @@ -79,8 +81,57 @@ template <typename Condition, typename Handler, void parallel_group_launch(Condition cancellation_condition, Handler handler, std::tuple<Ops...>& ops, boost::asio::detail::index_sequence<I...>); +// Helper trait for determining ranged parallel group completion signatures. + +template <typename Signature, typename Allocator> +struct ranged_parallel_group_signature; + +template <typename R, typename... Args, typename Allocator> +struct ranged_parallel_group_signature<R(Args...), Allocator> +{ + typedef std::vector<std::size_t, + BOOST_ASIO_REBIND_ALLOC(Allocator, std::size_t)> order_type; + typedef R raw_type( + std::vector<Args, BOOST_ASIO_REBIND_ALLOC(Allocator, Args)>...); + typedef R type(order_type, + std::vector<Args, BOOST_ASIO_REBIND_ALLOC(Allocator, Args)>...); +}; + +template <typename Condition, typename Handler, + typename Range, typename Allocator> +void ranged_parallel_group_launch(Condition cancellation_condition, + Handler handler, Range&& range, const Allocator& allocator); + +char (¶llel_group_has_iterator_helper(...))[2]; + +template <typename T> +char parallel_group_has_iterator_helper(T*, typename T::iterator* = 0); + +template <typename T> +struct parallel_group_has_iterator_typedef +{ + enum { value = (sizeof((parallel_group_has_iterator_helper)((T*)(0))) == 1) }; +}; + } // namespace detail +/// Type trait used to determine whether a type is a range of asynchronous +/// operations that can be used with with @c make_parallel_group. +template <typename T> +struct is_async_operation_range +{ +#if defined(GENERATING_DOCUMENTATION) + /// The value member is true if the type may be used as a range of + /// asynchronous operations. + static const bool value; +#else + enum + { + value = detail::parallel_group_has_iterator_typedef<T>::value + }; +#endif +}; + /// A group of asynchronous operations that may be launched in parallel. /** * See the documentation for boost::asio::experimental::make_parallel_group for @@ -196,6 +247,211 @@ make_parallel_group(Ops... ops) return parallel_group<Ops...>(std::move(ops)...); } +/// A range-based group of asynchronous operations that may be launched in +/// parallel. +/** + * See the documentation for boost::asio::experimental::make_parallel_group for + * a usage example. + */ +template <typename Range, typename Allocator = std::allocator<void> > +class ranged_parallel_group +{ +private: + struct initiate_async_wait + { + template <typename Handler, typename Condition> + void operator()(Handler&& h, Condition&& c, + Range&& range, const Allocator& allocator) const + { + detail::ranged_parallel_group_launch(std::move(c), + std::move(h), std::forward<Range>(range), allocator); + } + }; + + Range range_; + Allocator allocator_; + +public: + /// Constructor. + explicit ranged_parallel_group(Range range, + const Allocator& allocator = Allocator()) + : range_(std::move(range)), + allocator_(allocator) + { + } + + /// The completion signature for the group of operations. + typedef typename detail::ranged_parallel_group_signature< + typename completion_signature_of< + typename std::decay< + decltype(*std::declval<typename Range::iterator>())>::type>::type, + Allocator>::type signature; + + /// Initiate an asynchronous wait for the group of operations. + /** + * Launches the group and asynchronously waits for completion. + * + * @param cancellation_condition A function object, called on completion of + * an operation within the group, that is used to determine whether to cancel + * the remaining operations. The function object is passed the arguments of + * the completed operation's handler. To trigger cancellation of the remaining + * operations, it must return a boost::asio::cancellation_type value other + * than <tt>boost::asio::cancellation_type::none</tt>. + * + * @param token A @ref completion_token whose signature is comprised of + * a @c std::vector<std::size_t, Allocator> indicating the completion order of + * the operations, followed by a vector for each of the completion signature's + * arguments. + * + * The library provides the following @c cancellation_condition types: + * + * @li boost::asio::experimental::wait_for_all + * @li boost::asio::experimental::wait_for_one + * @li boost::asio::experimental::wait_for_one_error + * @li boost::asio::experimental::wait_for_one_success + */ + template <typename CancellationCondition, + BOOST_ASIO_COMPLETION_TOKEN_FOR(signature) CompletionToken> + BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(CompletionToken, signature) + async_wait(CancellationCondition cancellation_condition, + CompletionToken&& token) + BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + boost::asio::async_initiate<CompletionToken, signature>( + declval<initiate_async_wait>(), token, + std::move(cancellation_condition), + std::move(range_), allocator_))) + { + return boost::asio::async_initiate<CompletionToken, signature>( + initiate_async_wait(), token, + std::move(cancellation_condition), + std::move(range_), allocator_); + } +}; + +/// Create a group of operations that may be launched in parallel. +/** + * @param range A range containing the operations to be launched. + * + * For example: + * @code + * using op_type = decltype( + * socket1.async_read_some( + * boost::asio::buffer(data1), + * boost::asio::deferred + * ) + * ); + * + * std::vector<op_type> ops; + * + * ops.push_back( + * socket1.async_read_some( + * boost::asio::buffer(data1), + * boost::asio::deferred + * ) + * ); + * + * ops.push_back( + * socket2.async_read_some( + * boost::asio::buffer(data2), + * boost::asio::deferred + * ) + * ); + * + * boost::asio::experimental::make_parallel_group(ops).async_wait( + * boost::asio::experimental::wait_for_all(), + * []( + * std::vector<std::size_t> completion_order, + * std::vector<boost::system::error_code> e, + * std::vector<std::size_t> n + * ) + * { + * for (std::size_t i = 0; i < completion_order.size(); ++i) + * { + * std::size_t idx = completion_order[i]; + * std::cout << "socket " << idx << " finished: "; + * std::cout << e[idx] << ", " << n[idx] << "\n"; + * } + * } + * ); + * @endcode + */ +template <typename Range> +BOOST_ASIO_NODISCARD inline +ranged_parallel_group<typename std::decay<Range>::type> +make_parallel_group(Range&& range, + typename constraint< + is_async_operation_range<typename std::decay<Range>::type>::value + >::type = 0) +{ + return ranged_parallel_group<typename std::decay<Range>::type>( + std::forward<Range>(range)); +} + +/// Create a group of operations that may be launched in parallel. +/** + * @param allocator Specifies the allocator to be used with the result vectors. + * + * @param range A range containing the operations to be launched. + * + * For example: + * @code + * using op_type = decltype( + * socket1.async_read_some( + * boost::asio::buffer(data1), + * boost::asio::deferred + * ) + * ); + * + * std::vector<op_type> ops; + * + * ops.push_back( + * socket1.async_read_some( + * boost::asio::buffer(data1), + * boost::asio::deferred + * ) + * ); + * + * ops.push_back( + * socket2.async_read_some( + * boost::asio::buffer(data2), + * boost::asio::deferred + * ) + * ); + * + * boost::asio::experimental::make_parallel_group( + * std::allocator_arg_t, + * my_allocator, + * ops + * ).async_wait( + * boost::asio::experimental::wait_for_all(), + * []( + * std::vector<std::size_t> completion_order, + * std::vector<boost::system::error_code> e, + * std::vector<std::size_t> n + * ) + * { + * for (std::size_t i = 0; i < completion_order.size(); ++i) + * { + * std::size_t idx = completion_order[i]; + * std::cout << "socket " << idx << " finished: "; + * std::cout << e[idx] << ", " << n[idx] << "\n"; + * } + * } + * ); + * @endcode + */ +template <typename Allocator, typename Range> +BOOST_ASIO_NODISCARD inline +ranged_parallel_group<typename std::decay<Range>::type, Allocator> +make_parallel_group(allocator_arg_t, const Allocator& allocator, Range&& range, + typename constraint< + is_async_operation_range<typename std::decay<Range>::type>::value + >::type = 0) +{ + return ranged_parallel_group<typename std::decay<Range>::type, Allocator>( + std::forward<Range>(range), allocator); +} + } // namespace experimental } // namespace asio } // namespace boost diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/promise.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/promise.hpp index c5f857ef4e..e6f9454dac 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/promise.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/promise.hpp @@ -20,14 +20,14 @@ #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/any_io_executor.hpp> #include <boost/asio/associated_cancellation_slot.hpp> +#include <boost/asio/associated_executor.hpp> #include <boost/asio/bind_executor.hpp> #include <boost/asio/cancellation_signal.hpp> -#include <boost/asio/experimental/detail/completion_handler_erasure.hpp> +#include <boost/asio/dispatch.hpp> #include <boost/asio/experimental/impl/promise.hpp> #include <boost/asio/post.hpp> #include <algorithm> -#include <variant> #include <boost/asio/detail/push_options.hpp> @@ -35,11 +35,6 @@ namespace boost { namespace asio { namespace experimental { -template <typename Executor = any_io_executor> -struct use_promise_t {}; - -constexpr use_promise_t<> use_promise; - template <typename T> struct is_promise : std::false_type {}; @@ -64,40 +59,49 @@ struct promise_value_type<T> template <> struct promise_value_type<> { - using type = std::monostate; + using type = std::tuple<>; }; #if defined(GENERATING_DOCUMENTATION) -/// The primary template is not defined. -template<typename Signature = void(), typename Executor = any_io_executor> +/// A disposable handle for an eager operation. +/** + * @tparam Signature The signature of the operation. + * + * @tparam Executor The executor to be used by the promise (taken from the + * operation). + * + * @tparam Allocator The allocator used for the promise. Can be set through + * use_allocator. + * + * A promise can be used to initiate an asynchronous option that can be + * completed later. If the promise gets destroyed before completion, the + * operation gets a cancel signal and the result is ignored. + * + * A promise fulfills the requirements of async_operation. + * + * @par Examples + * Reading and writing from one coroutine. + * @code + * awaitable<void> read_write_some(boost::asio::ip::tcp::socket & sock, + * boost::asio::mutable_buffer read_buf, boost::asio::const_buffer to_write) + * { + * auto p = boost::asio::async_read(read_buf, boost::asio::use_awaitable); + * co_await boost::asio::async_write_some(to_write, boost::asio::deferred); + * co_await p; + * } + * @endcode + */ +template<typename Signature = void(), + typename Executor = boost::asio::any_io_executor, + typename Allocator = std::allocator<void>> struct promise -{ -}; +#else +template <typename ... Ts, typename Executor, typename Allocator> +struct promise<void(Ts...), Executor, Allocator> #endif // defined(GENERATING_DOCUMENTATION) - -template <typename ... Ts, typename Executor> -struct promise<void(Ts...), Executor> { + /// The value that's returned by the promise. using value_type = typename promise_value_type<Ts...>::type; - using tuple_type = std::tuple<Ts...>; - using executor_type = Executor; - - /// Rebinds the promise type to another executor. - template <typename Executor1> - struct rebind_executor - { - /// The file type when rebound to the specified executor. - typedef promise<void(Ts...), Executor1> other; - }; - - /// Get the executor of the promise - executor_type get_executor() const - { - if (impl_) - return impl_->executor; - else - return {}; - } /// Cancel the promise. Usually done through the destructor. void cancel(cancellation_type level = cancellation_type::all) @@ -105,22 +109,20 @@ struct promise<void(Ts...), Executor> if (impl_ && !impl_->done) { boost::asio::dispatch(impl_->executor, - [level, impl = impl_]{impl->cancel.emit(level);}); + [level, impl = impl_]{ impl->cancel.emit(level); }); } } /// Check if the promise is completed already. - bool complete() const noexcept + bool completed() const noexcept { return impl_ && impl_->done; } /// Wait for the promise to become ready. - template < - BOOST_ASIO_COMPLETION_TOKEN_FOR(void(Ts...)) CompletionToken - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)> - auto async_wait(CompletionToken&& token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) + template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void(Ts...)) CompletionToken> + inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void(Ts...)) + operator()(CompletionToken&& token) { assert(impl_); @@ -132,37 +134,52 @@ struct promise<void(Ts...), Executor> promise(const promise& ) = delete; promise(promise&& ) noexcept = default; + /// Destruct the promise and cancel the operation. + /** + * It is safe to destruct a promise of a promise that didn't complete. + */ ~promise() { cancel(); } private: #if !defined(GENERATING_DOCUMENTATION) - template <typename, typename> friend struct promise; - friend struct detail::promise_handler<void(Ts...)>; + template <typename, typename, typename> friend struct promise; + friend struct detail::promise_handler<void(Ts...), Executor, Allocator>; #endif // !defined(GENERATING_DOCUMENTATION) - std::shared_ptr<detail::promise_impl<void(Ts...), Executor>> impl_; - promise(std::shared_ptr<detail::promise_impl<void(Ts...), Executor>> impl) + std::shared_ptr<detail::promise_impl< + void(Ts...), Executor, Allocator>> impl_; + + promise( + std::shared_ptr<detail::promise_impl< + void(Ts...), Executor, Allocator>> impl) : impl_(impl) { } struct initiate_async_wait { - std::shared_ptr<detail::promise_impl<void(Ts...), Executor>> self_; + std::shared_ptr<detail::promise_impl< + void(Ts...), Executor, Allocator>> self_; template <typename WaitHandler> void operator()(WaitHandler&& handler) const { - const auto exec = get_associated_executor(handler, self_->executor); + const auto alloc = get_associated_allocator( + handler, self_->get_allocator()); + auto cancel = get_associated_cancellation_slot(handler); + if (self_->done) { + auto exec = boost::asio::get_associated_executor( + handler, self_->get_executor()); + boost::asio::post(exec, - [self = self_, h = std::forward<WaitHandler>(handler)]() mutable + [self = std::move(self_), + handler = std::forward<WaitHandler>(handler)]() mutable { - std::apply(std::forward<WaitHandler>(h), - std::move(*self->result)); + self->apply(std::move(handler)); }); } else @@ -171,26 +188,29 @@ private: { struct cancel_handler { - std::weak_ptr<detail::promise_impl<void(Ts...), Executor>> self; + std::weak_ptr<detail::promise_impl< + void(Ts...), Executor, Allocator>> self; cancel_handler( - std::weak_ptr<detail::promise_impl<void(Ts...), Executor>> self) + std::weak_ptr<detail::promise_impl< + void(Ts...), Executor, Allocator>> self) : self(std::move(self)) { } void operator()(cancellation_type level) const { - if (auto p = self.lock(); p != nullptr) + if (auto p = self.lock()) + { p->cancel.emit(level); - + p->cancel_(); + } } }; - cancel.template emplace<cancel_handler>(self_); } - self_->completion = {exec, std::forward<WaitHandler>(handler)}; + self_->set_completion(alloc, std::forward<WaitHandler>(handler)); } } }; @@ -198,30 +218,6 @@ private: } // namespace experimental -#if !defined(GENERATING_DOCUMENTATION) - -template <typename Executor, typename R, typename... Args> -struct async_result<experimental::use_promise_t<Executor>, R(Args...)> -{ - using handler_type = experimental::detail::promise_handler< - void(typename decay<Args>::type...), Executor>; - - using return_type = experimental::promise< - void(typename decay<Args>::type...), Executor>; - - template <typename Initiation, typename... InitArgs> - static auto initiate(Initiation initiation, - experimental::use_promise_t<Executor>, InitArgs... args) - -> typename handler_type::promise_type - { - handler_type ht{get_associated_executor(initiation)}; - std::move(initiation)(ht, std::move(args)...); - return ht.make_promise(); - } -}; - -#endif // !defined(GENERATING_DOCUMENTATION) - } // namespace asio } // namespace boost diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/use_coro.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/use_coro.hpp index e815422db8..eeb297229b 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/experimental/use_coro.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/use_coro.hpp @@ -17,11 +17,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <optional> -#include <boost/asio/bind_cancellation_slot.hpp> -#include <boost/asio/bind_executor.hpp> -#include <boost/system/error_code.hpp> -#include <boost/asio/experimental/detail/partial_promise.hpp> +#include <memory> +#include <boost/asio/deferred.hpp> +#include <boost/asio/detail/source_location.hpp> #include <boost/asio/detail/push_options.hpp> @@ -32,8 +30,7 @@ class any_io_executor; namespace experimental { -/// A @ref completion_token that represents the currently executing resumable -/// coroutine. +/// A @ref completion_token that creates another coro for the task completion. /** * The @c use_coro_t class, with its value @c use_coro, is used to represent an * operation that can be awaited by the current resumable coroutine. This @@ -50,26 +47,36 @@ namespace experimental { * above example) suspends the current coroutine. The coroutine is resumed when * the asynchronous operation completes, and the result of the operation is * returned. + * + * Note that this token is not the most efficient (use @c boost::asio::deferred + * for that) but does provide type erasure, as it will always return a @c coro. */ -template <typename Executor = any_io_executor> +template <typename Allocator = std::allocator<void>> struct use_coro_t { + + /// The allocator type. The allocator is used when constructing the + /// @c std::promise object for a given asynchronous operation. + typedef Allocator allocator_type; + /// Default constructor. BOOST_ASIO_CONSTEXPR use_coro_t( + allocator_type allocator = allocator_type{} #if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) # if defined(BOOST_ASIO_HAS_SOURCE_LOCATION) - boost::asio::detail::source_location location = + , boost::asio::detail::source_location location = boost::asio::detail::source_location::current() # endif // defined(BOOST_ASIO_HAS_SOURCE_LOCATION) #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) ) + : allocator_(allocator) #if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) # if defined(BOOST_ASIO_HAS_SOURCE_LOCATION) - : file_name_(location.file_name()), + , file_name_(location.file_name()), line_(location.line()), function_name_(location.function_name()) # else // defined(BOOST_ASIO_HAS_SOURCE_LOCATION) - : file_name_(0), + , file_name_(0), line_(0), function_name_(0) # endif // defined(BOOST_ASIO_HAS_SOURCE_LOCATION) @@ -77,14 +84,30 @@ struct use_coro_t { } + + /// Specify an alternate allocator. + template <typename OtherAllocator> + use_coro_t<OtherAllocator> rebind(const OtherAllocator& allocator) const + { + return use_future_t<OtherAllocator>(allocator); + } + + /// Obtain allocator. + allocator_type get_allocator() const + { + return allocator_; + } + /// Constructor used to specify file name, line, and function name. BOOST_ASIO_CONSTEXPR use_coro_t(const char* file_name, - int line, const char* function_name) + int line, const char* function_name, + allocator_type allocator = allocator_type{}) : #if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) - : file_name_(file_name), + file_name_(file_name), line_(line), - function_name_(function_name) + function_name_(function_name), #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + allocator_(allocator) { #if !defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) (void)file_name; @@ -144,6 +167,9 @@ struct use_coro_t int line_; const char* function_name_; #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +private: + Allocator allocator_; }; /// A @ref completion_token object that represents the currently executing diff --git a/contrib/restricted/boost/asio/include/boost/asio/experimental/use_promise.hpp b/contrib/restricted/boost/asio/include/boost/asio/experimental/use_promise.hpp new file mode 100644 index 0000000000..b7b70cefbb --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/use_promise.hpp @@ -0,0 +1,113 @@ +// +// experimental/use_promise.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2022 Klemens D. Morgenstern +// (klemens dot morgenstern at gmx dot net) +// +// 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 BOOST_ASIO_EXPERIMENTAL_USE_PROMISE_HPP +#define BOOST_ASIO_EXPERIMENTAL_USE_PROMISE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <memory> +#include <boost/asio/detail/type_traits.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace experimental { + +template <typename Allocator = std::allocator<void>> +struct use_promise_t +{ + /// The allocator type. The allocator is used when constructing the + /// @c promise object for a given asynchronous operation. + typedef Allocator allocator_type; + + /// Construct using default-constructed allocator. + BOOST_ASIO_CONSTEXPR use_promise_t() + { + } + + /// Construct using specified allocator. + explicit use_promise_t(const Allocator& allocator) + : allocator_(allocator) + { + } + + /// Obtain allocator. + allocator_type get_allocator() const BOOST_ASIO_NOEXCEPT + { + return allocator_; + } + + /// Adapts an executor to add the @c use_promise_t completion token as the + /// default. + template <typename InnerExecutor> + struct executor_with_default : InnerExecutor + { + /// Specify @c use_promise_t as the default completion token type. + typedef use_promise_t<Allocator> default_completion_token_type; + + /// Construct the adapted executor from the inner executor type. + executor_with_default(const InnerExecutor& ex) BOOST_ASIO_NOEXCEPT + : InnerExecutor(ex) + { + } + + /// Convert the specified executor to the inner executor type, then use + /// that to construct the adapted executor. + template <typename OtherExecutor> + executor_with_default(const OtherExecutor& ex, + typename constraint< + is_convertible<OtherExecutor, InnerExecutor>::value + >::type = 0) BOOST_ASIO_NOEXCEPT + : InnerExecutor(ex) + { + } + }; + + /// Function helper to adapt an I/O object to use @c use_promise_t as its + /// default completion token type. + template <typename T> + static typename decay<T>::type::template rebind_executor< + executor_with_default<typename decay<T>::type::executor_type> + >::other + as_default_on(BOOST_ASIO_MOVE_ARG(T) object) + { + return typename decay<T>::type::template rebind_executor< + executor_with_default<typename decay<T>::type::executor_type> + >::other(BOOST_ASIO_MOVE_CAST(T)(object)); + } + + /// Specify an alternate allocator. + template <typename OtherAllocator> + use_promise_t<OtherAllocator> rebind(const OtherAllocator& allocator) const + { + return use_promise_t<OtherAllocator>(allocator); + } + +private: + Allocator allocator_; +}; + +constexpr use_promise_t<> use_promise; + +} // namespace experimental +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#include <boost/asio/experimental/impl/use_promise.hpp> + +#endif // BOOST_ASIO_EXPERIMENTAL_USE_CORO_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/any_completion_executor.ipp b/contrib/restricted/boost/asio/include/boost/asio/impl/any_completion_executor.ipp new file mode 100644 index 0000000000..c947361868 --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/any_completion_executor.ipp @@ -0,0 +1,132 @@ +// +// impl/any_completion_executor.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// 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) +// + +#ifndef BOOST_ASIO_IMPL_ANY_COMPLETION_EXECUTOR_IPP +#define BOOST_ASIO_IMPL_ANY_COMPLETION_EXECUTOR_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) + +#include <boost/asio/any_completion_executor.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +any_completion_executor::any_completion_executor() BOOST_ASIO_NOEXCEPT + : base_type() +{ +} + +any_completion_executor::any_completion_executor(nullptr_t) BOOST_ASIO_NOEXCEPT + : base_type(nullptr_t()) +{ +} + +any_completion_executor::any_completion_executor( + const any_completion_executor& e) BOOST_ASIO_NOEXCEPT + : base_type(static_cast<const base_type&>(e)) +{ +} + +any_completion_executor::any_completion_executor(std::nothrow_t, + const any_completion_executor& e) BOOST_ASIO_NOEXCEPT + : base_type(static_cast<const base_type&>(e)) +{ +} + +#if defined(BOOST_ASIO_HAS_MOVE) +any_completion_executor::any_completion_executor( + any_completion_executor&& e) BOOST_ASIO_NOEXCEPT + : base_type(static_cast<base_type&&>(e)) +{ +} + +any_completion_executor::any_completion_executor(std::nothrow_t, + any_completion_executor&& e) BOOST_ASIO_NOEXCEPT + : base_type(static_cast<base_type&&>(e)) +{ +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + +any_completion_executor& any_completion_executor::operator=( + const any_completion_executor& e) BOOST_ASIO_NOEXCEPT +{ + base_type::operator=(static_cast<const base_type&>(e)); + return *this; +} + +#if defined(BOOST_ASIO_HAS_MOVE) +any_completion_executor& any_completion_executor::operator=( + any_completion_executor&& e) BOOST_ASIO_NOEXCEPT +{ + base_type::operator=(static_cast<base_type&&>(e)); + return *this; +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + +any_completion_executor& any_completion_executor::operator=(nullptr_t) +{ + base_type::operator=(nullptr_t()); + return *this; +} + +any_completion_executor::~any_completion_executor() +{ +} + +void any_completion_executor::swap( + any_completion_executor& other) BOOST_ASIO_NOEXCEPT +{ + static_cast<base_type&>(*this).swap(static_cast<base_type&>(other)); +} + +template <> +any_completion_executor any_completion_executor::prefer( + const execution::outstanding_work_t::tracked_t& p, int) const +{ + return static_cast<const base_type&>(*this).prefer(p); +} + +template <> +any_completion_executor any_completion_executor::prefer( + const execution::outstanding_work_t::untracked_t& p, int) const +{ + return static_cast<const base_type&>(*this).prefer(p); +} + +template <> +any_completion_executor any_completion_executor::prefer( + const execution::relationship_t::fork_t& p, int) const +{ + return static_cast<const base_type&>(*this).prefer(p); +} + +template <> +any_completion_executor any_completion_executor::prefer( + const execution::relationship_t::continuation_t& p, int) const +{ + return static_cast<const base_type&>(*this).prefer(p); +} + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT) + +#endif // BOOST_ASIO_IMPL_ANY_COMPLETION_EXECUTOR_IPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/any_io_executor.ipp b/contrib/restricted/boost/asio/include/boost/asio/impl/any_io_executor.ipp index c7dc91972b..2524fccd63 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/any_io_executor.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/any_io_executor.ipp @@ -41,11 +41,23 @@ any_io_executor::any_io_executor(const any_io_executor& e) BOOST_ASIO_NOEXCEPT { } +any_io_executor::any_io_executor(std::nothrow_t, + const any_io_executor& e) BOOST_ASIO_NOEXCEPT + : base_type(static_cast<const base_type&>(e)) +{ +} + #if defined(BOOST_ASIO_HAS_MOVE) any_io_executor::any_io_executor(any_io_executor&& e) BOOST_ASIO_NOEXCEPT : base_type(static_cast<base_type&&>(e)) { } + +any_io_executor::any_io_executor(std::nothrow_t, + any_io_executor&& e) BOOST_ASIO_NOEXCEPT + : base_type(static_cast<base_type&&>(e)) +{ +} #endif // defined(BOOST_ASIO_HAS_MOVE) any_io_executor& any_io_executor::operator=( diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/append.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/append.hpp index 2a6f75d09c..54e7030f2e 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/append.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/append.hpp @@ -200,9 +200,18 @@ struct associator<Associator, detail::append_handler<Handler, Values...>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::append_handler<Handler, Values...>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::append_handler<Handler, Values...>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::append_handler<Handler, Values...>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/as_tuple.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/as_tuple.hpp index 735cbc41e7..c373f7f858 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/as_tuple.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/as_tuple.hpp @@ -228,9 +228,18 @@ struct associator<Associator, detail::as_tuple_handler<Handler>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::as_tuple_handler<Handler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::as_tuple_handler<Handler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::as_tuple_handler<Handler>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/buffered_read_stream.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/buffered_read_stream.hpp index e674b317a5..dffca02f82 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/buffered_read_stream.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/buffered_read_stream.hpp @@ -209,9 +209,18 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::buffered_fill_handler<ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::buffered_fill_handler<ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::buffered_fill_handler<ReadHandler>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -449,10 +458,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::buffered_read_some_handler< + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::buffered_read_some_handler< + MutableBufferSequence, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::buffered_read_some_handler< MutableBufferSequence, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/buffered_write_stream.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/buffered_write_stream.hpp index 7f67be0185..4e94ee1bda 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/buffered_write_stream.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/buffered_write_stream.hpp @@ -189,9 +189,18 @@ struct associator<Associator, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { - static typename Associator<WriteHandler, DefaultCandidate>::type get( - const detail::buffered_flush_handler<WriteHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<WriteHandler, DefaultCandidate>::type + get(const detail::buffered_flush_handler<WriteHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<WriteHandler, DefaultCandidate>::type) + get(const detail::buffered_flush_handler<WriteHandler>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } @@ -435,10 +444,20 @@ struct associator<Associator, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { - static typename Associator<WriteHandler, DefaultCandidate>::type get( - const detail::buffered_write_some_handler< + static typename Associator<WriteHandler, DefaultCandidate>::type + get(const detail::buffered_write_some_handler< + ConstBufferSequence, WriteHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<WriteHandler, DefaultCandidate>::type) + get(const detail::buffered_write_some_handler< ConstBufferSequence, WriteHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/co_spawn.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/co_spawn.hpp index 03f82ac0e5..c5aab716ee 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/co_spawn.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/co_spawn.hpp @@ -97,23 +97,20 @@ awaitable<awaitable_thread_entry_point, Executor> co_spawn_entry_point( done = true; - if (co_await awaitable_thread_has_context_switched{}) + bool switched = (co_await awaitable_thread_has_context_switched{}); + if (!switched) { - (dispatch)(handler_work.get_executor(), - [handler = std::move(handler), t = std::move(t)]() mutable - { - std::move(handler)(std::exception_ptr(), std::move(t)); - }); - } - else - { - (post)(handler_work.get_executor(), - [handler = std::move(handler), t = std::move(t)]() mutable - { - std::move(handler)(std::exception_ptr(), std::move(t)); - }); + (void) co_await (post)( + use_awaitable_t<Executor>{__FILE__, + __LINE__, "co_spawn_entry_point"}); } + (dispatch)(handler_work.get_executor(), + [handler = std::move(handler), t = std::move(t)]() mutable + { + std::move(handler)(std::exception_ptr(), std::move(t)); + }); + co_return; } catch (...) @@ -124,22 +121,18 @@ awaitable<awaitable_thread_entry_point, Executor> co_spawn_entry_point( e = std::current_exception(); } - if (co_await awaitable_thread_has_context_switched{}) + bool switched = (co_await awaitable_thread_has_context_switched{}); + if (!switched) { - (dispatch)(handler_work.get_executor(), - [handler = std::move(handler), e]() mutable - { - std::move(handler)(e, T()); - }); - } - else - { - (post)(handler_work.get_executor(), - [handler = std::move(handler), e]() mutable - { - std::move(handler)(e, T()); - }); + (void) co_await (post)( + use_awaitable_t<Executor>{__FILE__, __LINE__, "co_spawn_entry_point"}); } + + (dispatch)(handler_work.get_executor(), + [handler = std::move(handler), e]() mutable + { + std::move(handler)(e, T()); + }); } template <typename Executor, typename F, typename Handler> @@ -164,22 +157,18 @@ awaitable<awaitable_thread_entry_point, Executor> co_spawn_entry_point( e = std::current_exception(); } - if (co_await awaitable_thread_has_context_switched{}) - { - (dispatch)(handler_work.get_executor(), - [handler = std::move(handler), e]() mutable - { - std::move(handler)(e); - }); - } - else + bool switched = (co_await awaitable_thread_has_context_switched{}); + if (!switched) { - (post)(handler_work.get_executor(), - [handler = std::move(handler), e]() mutable - { - std::move(handler)(e); - }); + (void) co_await (post)( + use_awaitable_t<Executor>{__FILE__, __LINE__, "co_spawn_entry_point"}); } + + (dispatch)(handler_work.get_executor(), + [handler = std::move(handler), e]() mutable + { + std::move(handler)(e); + }); } template <typename T, typename Executor> @@ -204,8 +193,8 @@ template <typename Handler, typename Executor, typename = void> class co_spawn_cancellation_handler { public: - co_spawn_cancellation_handler(const Handler& handler, const Executor& ex) - : ex_(boost::asio::get_associated_executor(handler, ex)) + co_spawn_cancellation_handler(const Handler&, const Executor& ex) + : ex_(ex) { } @@ -222,7 +211,7 @@ public: private: cancellation_signal signal_; - typename associated_executor<Handler, Executor>::type ex_; + Executor ex_; }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/compose.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/compose.hpp deleted file mode 100644 index 3df2f07612..0000000000 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/compose.hpp +++ /dev/null @@ -1,709 +0,0 @@ -// -// impl/compose.hpp -// ~~~~~~~~~~~~~~~~ -// -// 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) -// - -#ifndef BOOST_ASIO_IMPL_COMPOSE_HPP -#define BOOST_ASIO_IMPL_COMPOSE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/associated_executor.hpp> -#include <boost/asio/detail/base_from_cancellation_state.hpp> -#include <boost/asio/detail/handler_alloc_helpers.hpp> -#include <boost/asio/detail/handler_cont_helpers.hpp> -#include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/type_traits.hpp> -#include <boost/asio/detail/variadic_templates.hpp> -#include <boost/asio/execution/executor.hpp> -#include <boost/asio/execution/outstanding_work.hpp> -#include <boost/asio/executor_work_guard.hpp> -#include <boost/asio/is_executor.hpp> -#include <boost/asio/system_executor.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { - -namespace detail -{ - template <typename Executor, typename = void> - class composed_work_guard - { - public: - typedef typename decay< - typename prefer_result<Executor, - execution::outstanding_work_t::tracked_t - >::type - >::type executor_type; - - composed_work_guard(const Executor& ex) - : executor_(boost::asio::prefer(ex, execution::outstanding_work.tracked)) - { - } - - void reset() - { - } - - executor_type get_executor() const BOOST_ASIO_NOEXCEPT - { - return executor_; - } - - private: - executor_type executor_; - }; - - template <> - struct composed_work_guard<system_executor> - { - public: - typedef system_executor executor_type; - - composed_work_guard(const system_executor&) - { - } - - void reset() - { - } - - executor_type get_executor() const BOOST_ASIO_NOEXCEPT - { - return system_executor(); - } - }; - -#if !defined(BOOST_ASIO_NO_TS_EXECUTORS) - - template <typename Executor> - struct composed_work_guard<Executor, - typename enable_if< - !execution::is_executor<Executor>::value - >::type> : executor_work_guard<Executor> - { - composed_work_guard(const Executor& ex) - : executor_work_guard<Executor>(ex) - { - } - }; - -#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) - - template <typename> - struct composed_io_executors; - - template <> - struct composed_io_executors<void()> - { - composed_io_executors() BOOST_ASIO_NOEXCEPT - : head_(system_executor()) - { - } - - typedef system_executor head_type; - system_executor head_; - }; - - inline composed_io_executors<void()> make_composed_io_executors() - { - return composed_io_executors<void()>(); - } - - template <typename Head> - struct composed_io_executors<void(Head)> - { - explicit composed_io_executors(const Head& ex) BOOST_ASIO_NOEXCEPT - : head_(ex) - { - } - - typedef Head head_type; - Head head_; - }; - - template <typename Head> - inline composed_io_executors<void(Head)> - make_composed_io_executors(const Head& head) - { - return composed_io_executors<void(Head)>(head); - } - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename Head, typename... Tail> - struct composed_io_executors<void(Head, Tail...)> - { - explicit composed_io_executors(const Head& head, - const Tail&... tail) BOOST_ASIO_NOEXCEPT - : head_(head), - tail_(tail...) - { - } - - void reset() - { - head_.reset(); - tail_.reset(); - } - - typedef Head head_type; - Head head_; - composed_io_executors<void(Tail...)> tail_; - }; - - template <typename Head, typename... Tail> - inline composed_io_executors<void(Head, Tail...)> - make_composed_io_executors(const Head& head, const Tail&... tail) - { - return composed_io_executors<void(Head, Tail...)>(head, tail...); - } - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#define BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF(n) \ - template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - struct composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \ - { \ - explicit composed_io_executors(const Head& head, \ - BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) BOOST_ASIO_NOEXCEPT \ - : head_(head), \ - tail_(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) \ - { \ - } \ - \ - void reset() \ - { \ - head_.reset(); \ - tail_.reset(); \ - } \ - \ - typedef Head head_type; \ - Head head_; \ - composed_io_executors<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \ - }; \ - \ - template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - inline composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \ - make_composed_io_executors(const Head& head, \ - BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) \ - { \ - return composed_io_executors< \ - void(Head, BOOST_ASIO_VARIADIC_TARGS(n))>( \ - head, BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF) -#undef BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename> - struct composed_work; - - template <> - struct composed_work<void()> - { - typedef composed_io_executors<void()> executors_type; - - composed_work(const executors_type&) BOOST_ASIO_NOEXCEPT - : head_(system_executor()) - { - } - - void reset() - { - head_.reset(); - } - - typedef system_executor head_type; - composed_work_guard<system_executor> head_; - }; - - template <typename Head> - struct composed_work<void(Head)> - { - typedef composed_io_executors<void(Head)> executors_type; - - explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT - : head_(ex.head_) - { - } - - void reset() - { - head_.reset(); - } - - typedef Head head_type; - composed_work_guard<Head> head_; - }; - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template <typename Head, typename... Tail> - struct composed_work<void(Head, Tail...)> - { - typedef composed_io_executors<void(Head, Tail...)> executors_type; - - explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT - : head_(ex.head_), - tail_(ex.tail_) - { - } - - void reset() - { - head_.reset(); - tail_.reset(); - } - - typedef Head head_type; - composed_work_guard<Head> head_; - composed_work<void(Tail...)> tail_; - }; - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#define BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF(n) \ - template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - struct composed_work<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \ - { \ - typedef composed_io_executors<void(Head, \ - BOOST_ASIO_VARIADIC_TARGS(n))> executors_type; \ - \ - explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT \ - : head_(ex.head_), \ - tail_(ex.tail_) \ - { \ - } \ - \ - void reset() \ - { \ - head_.reset(); \ - tail_.reset(); \ - } \ - \ - typedef Head head_type; \ - composed_work_guard<Head> head_; \ - composed_work<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF) -#undef BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - template <typename Impl, typename Work, typename Handler, typename Signature> - class composed_op; - - template <typename Impl, typename Work, typename Handler, - typename R, typename... Args> - class composed_op<Impl, Work, Handler, R(Args...)> -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - template <typename Impl, typename Work, typename Handler, typename Signature> - class composed_op -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - : public base_from_cancellation_state<Handler> - { - public: - template <typename I, typename W, typename H> - composed_op(BOOST_ASIO_MOVE_ARG(I) impl, - BOOST_ASIO_MOVE_ARG(W) work, - BOOST_ASIO_MOVE_ARG(H) handler) - : base_from_cancellation_state<Handler>( - handler, enable_terminal_cancellation()), - impl_(BOOST_ASIO_MOVE_CAST(I)(impl)), - work_(BOOST_ASIO_MOVE_CAST(W)(work)), - handler_(BOOST_ASIO_MOVE_CAST(H)(handler)), - invocations_(0) - { - } - -#if defined(BOOST_ASIO_HAS_MOVE) - composed_op(composed_op&& other) - : base_from_cancellation_state<Handler>( - BOOST_ASIO_MOVE_CAST(base_from_cancellation_state< - Handler>)(other)), - impl_(BOOST_ASIO_MOVE_CAST(Impl)(other.impl_)), - work_(BOOST_ASIO_MOVE_CAST(Work)(other.work_)), - handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)), - invocations_(other.invocations_) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) - - typedef typename associated_executor<Handler, - typename composed_work_guard< - typename Work::head_type - >::executor_type - >::type executor_type; - - executor_type get_executor() const BOOST_ASIO_NOEXCEPT - { - return (get_associated_executor)(handler_, work_.head_.get_executor()); - } - - typedef typename associated_allocator<Handler, - std::allocator<void> >::type allocator_type; - - allocator_type get_allocator() const BOOST_ASIO_NOEXCEPT - { - return (get_associated_allocator)(handler_, std::allocator<void>()); - } - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template<typename... T> - void operator()(BOOST_ASIO_MOVE_ARG(T)... t) - { - if (invocations_ < ~0u) - ++invocations_; - this->get_cancellation_state().slot().clear(); - impl_(*this, BOOST_ASIO_MOVE_CAST(T)(t)...); - } - - void complete(Args... args) - { - this->work_.reset(); - BOOST_ASIO_MOVE_OR_LVALUE(Handler)(this->handler_)( - BOOST_ASIO_MOVE_CAST(Args)(args)...); - } - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - void operator()() - { - if (invocations_ < ~0u) - ++invocations_; - this->get_cancellation_state().slot().clear(); - impl_(*this); - } - - void complete() - { - this->work_.reset(); - BOOST_ASIO_MOVE_OR_LVALUE(Handler)(this->handler_)(); - } - -#define BOOST_ASIO_PRIVATE_COMPOSED_OP_DEF(n) \ - template<BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - void operator()(BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - if (invocations_ < ~0u) \ - ++invocations_; \ - this->get_cancellation_state().slot().clear(); \ - impl_(*this, BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template<BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - void complete(BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - this->work_.reset(); \ - BOOST_ASIO_MOVE_OR_LVALUE(Handler)(this->handler_)( \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_OP_DEF) -#undef BOOST_ASIO_PRIVATE_COMPOSED_OP_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - void reset_cancellation_state() - { - base_from_cancellation_state<Handler>::reset_cancellation_state(handler_); - } - - template <typename Filter> - void reset_cancellation_state(BOOST_ASIO_MOVE_ARG(Filter) filter) - { - base_from_cancellation_state<Handler>::reset_cancellation_state(handler_, - BOOST_ASIO_MOVE_CAST(Filter)(filter)); - } - - template <typename InFilter, typename OutFilter> - void reset_cancellation_state(BOOST_ASIO_MOVE_ARG(InFilter) in_filter, - BOOST_ASIO_MOVE_ARG(OutFilter) out_filter) - { - base_from_cancellation_state<Handler>::reset_cancellation_state(handler_, - BOOST_ASIO_MOVE_CAST(InFilter)(in_filter), - BOOST_ASIO_MOVE_CAST(OutFilter)(out_filter)); - } - - //private: - Impl impl_; - Work work_; - Handler handler_; - unsigned invocations_; - }; - - template <typename Impl, typename Work, typename Handler, typename Signature> - inline asio_handler_allocate_is_deprecated - asio_handler_allocate(std::size_t size, - composed_op<Impl, Work, Handler, Signature>* this_handler) - { -#if defined(BOOST_ASIO_NO_DEPRECATED) - boost_asio_handler_alloc_helpers::allocate(size, this_handler->handler_); - return asio_handler_allocate_is_no_longer_used(); -#else // defined(BOOST_ASIO_NO_DEPRECATED) - return boost_asio_handler_alloc_helpers::allocate( - size, this_handler->handler_); -#endif // defined(BOOST_ASIO_NO_DEPRECATED) - } - - template <typename Impl, typename Work, typename Handler, typename Signature> - inline asio_handler_deallocate_is_deprecated - asio_handler_deallocate(void* pointer, std::size_t size, - composed_op<Impl, Work, Handler, Signature>* this_handler) - { - boost_asio_handler_alloc_helpers::deallocate( - pointer, size, this_handler->handler_); -#if defined(BOOST_ASIO_NO_DEPRECATED) - return asio_handler_deallocate_is_no_longer_used(); -#endif // defined(BOOST_ASIO_NO_DEPRECATED) - } - - template <typename Impl, typename Work, typename Handler, typename Signature> - inline bool asio_handler_is_continuation( - composed_op<Impl, Work, Handler, Signature>* this_handler) - { - return this_handler->invocations_ > 1 ? true - : boost_asio_handler_cont_helpers::is_continuation( - this_handler->handler_); - } - - template <typename Function, typename Impl, - typename Work, typename Handler, typename Signature> - inline asio_handler_invoke_is_deprecated - asio_handler_invoke(Function& function, - composed_op<Impl, Work, Handler, Signature>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); -#if defined(BOOST_ASIO_NO_DEPRECATED) - return asio_handler_invoke_is_no_longer_used(); -#endif // defined(BOOST_ASIO_NO_DEPRECATED) - } - - template <typename Function, typename Impl, - typename Work, typename Handler, typename Signature> - inline asio_handler_invoke_is_deprecated - asio_handler_invoke(const Function& function, - composed_op<Impl, Work, Handler, Signature>* this_handler) - { - boost_asio_handler_invoke_helpers::invoke( - function, this_handler->handler_); -#if defined(BOOST_ASIO_NO_DEPRECATED) - return asio_handler_invoke_is_no_longer_used(); -#endif // defined(BOOST_ASIO_NO_DEPRECATED) - } - - template <typename Signature, typename Executors> - class initiate_composed_op - { - public: - typedef typename composed_io_executors<Executors>::head_type executor_type; - - template <typename T> - explicit initiate_composed_op(int, BOOST_ASIO_MOVE_ARG(T) executors) - : executors_(BOOST_ASIO_MOVE_CAST(T)(executors)) - { - } - - executor_type get_executor() const BOOST_ASIO_NOEXCEPT - { - return executors_.head_; - } - - template <typename Handler, typename Impl> - void operator()(BOOST_ASIO_MOVE_ARG(Handler) handler, - BOOST_ASIO_MOVE_ARG(Impl) impl) const - { - composed_op<typename decay<Impl>::type, composed_work<Executors>, - typename decay<Handler>::type, Signature>( - BOOST_ASIO_MOVE_CAST(Impl)(impl), - composed_work<Executors>(executors_), - BOOST_ASIO_MOVE_CAST(Handler)(handler))(); - } - - private: - composed_io_executors<Executors> executors_; - }; - - template <typename Signature, typename Executors> - inline initiate_composed_op<Signature, Executors> make_initiate_composed_op( - BOOST_ASIO_MOVE_ARG(composed_io_executors<Executors>) executors) - { - return initiate_composed_op<Signature, Executors>(0, - BOOST_ASIO_MOVE_CAST(composed_io_executors<Executors>)(executors)); - } - - template <typename IoObject> - inline typename IoObject::executor_type - get_composed_io_executor(IoObject& io_object, - typename enable_if< - !is_executor<IoObject>::value - >::type* = 0, - typename enable_if< - !execution::is_executor<IoObject>::value - >::type* = 0) - { - return io_object.get_executor(); - } - - template <typename Executor> - inline const Executor& get_composed_io_executor(const Executor& ex, - typename enable_if< - is_executor<Executor>::value - || execution::is_executor<Executor>::value - >::type* = 0) - { - return ex; - } -} // namespace detail - -#if !defined(GENERATING_DOCUMENTATION) - -template <template <typename, typename> class Associator, - typename Impl, typename Work, typename Handler, - typename Signature, typename DefaultCandidate> -struct associator<Associator, - detail::composed_op<Impl, Work, Handler, Signature>, - DefaultCandidate> - : Associator<Handler, DefaultCandidate> -{ - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::composed_op<Impl, Work, Handler, Signature>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT - { - return Associator<Handler, DefaultCandidate>::get(h.handler_, c); - } -}; - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename CompletionToken, typename Signature, - typename Implementation, typename... IoObjectsOrExecutors> -BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature) -async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, - BOOST_ASIO_MOVE_ARG(IoObjectsOrExecutors)... io_objects_or_executors) -{ - return async_initiate<CompletionToken, Signature>( - detail::make_initiate_composed_op<Signature>( - detail::make_composed_io_executors( - detail::get_composed_io_executor( - BOOST_ASIO_MOVE_CAST(IoObjectsOrExecutors)( - io_objects_or_executors))...)), - token, BOOST_ASIO_MOVE_CAST(Implementation)(implementation)); -} - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template <typename CompletionToken, typename Signature, typename Implementation> -BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature) -async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token) -{ - return async_initiate<CompletionToken, Signature>( - detail::make_initiate_composed_op<Signature>( - detail::make_composed_io_executors()), - token, BOOST_ASIO_MOVE_CAST(Implementation)(implementation)); -} - -# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n) \ - BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_##n - -# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_1 \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)) -# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_2 \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)) -# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_3 \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)) -# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_4 \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4)) -# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_5 \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T5)(x5)) -# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_6 \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T5)(x5)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T6)(x6)) -# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_7 \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T5)(x5)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T6)(x6)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T7)(x7)) -# define BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_8 \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T1)(x1)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T2)(x2)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T3)(x3)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T4)(x4)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T5)(x5)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T6)(x6)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T7)(x7)), \ - detail::get_composed_io_executor(BOOST_ASIO_MOVE_CAST(T8)(x8)) - -#define BOOST_ASIO_PRIVATE_ASYNC_COMPOSE_DEF(n) \ - template <typename CompletionToken, typename Signature, \ - typename Implementation, BOOST_ASIO_VARIADIC_TPARAMS(n)> \ - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, Signature) \ - async_compose(BOOST_ASIO_MOVE_ARG(Implementation) implementation, \ - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - return async_initiate<CompletionToken, Signature>( \ - detail::make_initiate_composed_op<Signature>( \ - detail::make_composed_io_executors( \ - BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR(n))), \ - token, BOOST_ASIO_MOVE_CAST(Implementation)(implementation)); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_ASYNC_COMPOSE_DEF) -#undef BOOST_ASIO_PRIVATE_ASYNC_COMPOSE_DEF - -#undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR -#undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_1 -#undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_2 -#undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_3 -#undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_4 -#undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_5 -#undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_6 -#undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_7 -#undef BOOST_ASIO_PRIVATE_GET_COMPOSED_IO_EXECUTOR_8 - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) -#endif // !defined(GENERATING_DOCUMENTATION) - -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_IMPL_COMPOSE_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/connect.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/connect.hpp index 94d8d2cb43..3ba192ba4c 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/connect.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/connect.hpp @@ -765,10 +765,21 @@ struct associator<Associator, DefaultCandidate> : Associator<RangeConnectHandler, DefaultCandidate> { - static typename Associator<RangeConnectHandler, DefaultCandidate>::type get( - const detail::range_connect_op<Protocol, Executor, + static typename Associator<RangeConnectHandler, DefaultCandidate>::type + get(const detail::range_connect_op<Protocol, Executor, EndpointSequence, + ConnectCondition, RangeConnectHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<RangeConnectHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<RangeConnectHandler, DefaultCandidate>::type) + get(const detail::range_connect_op<Protocol, Executor, EndpointSequence, ConnectCondition, RangeConnectHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<RangeConnectHandler, DefaultCandidate>::get( + h.handler_, c))) { return Associator<RangeConnectHandler, DefaultCandidate>::get( h.handler_, c); @@ -786,10 +797,21 @@ struct associator<Associator, : Associator<IteratorConnectHandler, DefaultCandidate> { static typename Associator<IteratorConnectHandler, DefaultCandidate>::type - get( - const detail::iterator_connect_op<Protocol, Executor, + get(const detail::iterator_connect_op<Protocol, Executor, Iterator, + ConnectCondition, IteratorConnectHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<IteratorConnectHandler, DefaultCandidate>::get( + h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<IteratorConnectHandler, DefaultCandidate>::type) + get(const detail::iterator_connect_op<Protocol, Executor, Iterator, ConnectCondition, IteratorConnectHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<IteratorConnectHandler, DefaultCandidate>::get( + h.handler_, c))) { return Associator<IteratorConnectHandler, DefaultCandidate>::get( h.handler_, c); diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/consign.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/consign.hpp new file mode 100644 index 0000000000..96a6811f9b --- /dev/null +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/consign.hpp @@ -0,0 +1,204 @@ +// +// impl/consign.hpp +// ~~~~~~~~~~~~~~~~ +// +// 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) +// + +#ifndef BOOST_ASIO_IMPL_CONSIGN_HPP +#define BOOST_ASIO_IMPL_CONSIGN_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <boost/asio/associator.hpp> +#include <boost/asio/async_result.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/handler_cont_helpers.hpp> +#include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/type_traits.hpp> +#include <boost/asio/detail/utility.hpp> +#include <boost/asio/detail/variadic_templates.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +// Class to adapt a consign_t as a completion handler. +template <typename Handler, typename... Values> +class consign_handler +{ +public: + typedef void result_type; + + template <typename H> + consign_handler(BOOST_ASIO_MOVE_ARG(H) handler, std::tuple<Values...> values) + : handler_(BOOST_ASIO_MOVE_CAST(H)(handler)), + values_(BOOST_ASIO_MOVE_CAST(std::tuple<Values...>)(values)) + { + } + + template <typename... Args> + void operator()(BOOST_ASIO_MOVE_ARG(Args)... args) + { + BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler_)( + BOOST_ASIO_MOVE_CAST(Args)(args)...); + } + +//private: + Handler handler_; + std::tuple<Values...> values_; +}; + +template <typename Handler> +inline asio_handler_allocate_is_deprecated +asio_handler_allocate(std::size_t size, + consign_handler<Handler>* this_handler) +{ +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost_asio_handler_alloc_helpers::allocate(size, this_handler->handler_); + return asio_handler_allocate_is_no_longer_used(); +#else // defined(BOOST_ASIO_NO_DEPRECATED) + return boost_asio_handler_alloc_helpers::allocate( + size, this_handler->handler_); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) +} + +template <typename Handler> +inline asio_handler_deallocate_is_deprecated +asio_handler_deallocate(void* pointer, std::size_t size, + consign_handler<Handler>* this_handler) +{ + boost_asio_handler_alloc_helpers::deallocate( + pointer, size, this_handler->handler_); +#if defined(BOOST_ASIO_NO_DEPRECATED) + return asio_handler_deallocate_is_no_longer_used(); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) +} + +template <typename Handler> +inline bool asio_handler_is_continuation( + consign_handler<Handler>* this_handler) +{ + return boost_asio_handler_cont_helpers::is_continuation( + this_handler->handler_); +} + +template <typename Function, typename Handler> +inline asio_handler_invoke_is_deprecated +asio_handler_invoke(Function& function, + consign_handler<Handler>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +#if defined(BOOST_ASIO_NO_DEPRECATED) + return asio_handler_invoke_is_no_longer_used(); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) +} + +template <typename Function, typename Handler> +inline asio_handler_invoke_is_deprecated +asio_handler_invoke(const Function& function, + consign_handler<Handler>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +#if defined(BOOST_ASIO_NO_DEPRECATED) + return asio_handler_invoke_is_no_longer_used(); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) +} + +} // namespace detail + +#if !defined(GENERATING_DOCUMENTATION) + +template <typename CompletionToken, typename... Values, typename... Signatures> +struct async_result< + consign_t<CompletionToken, Values...>, Signatures...> + : async_result<CompletionToken, Signatures...> +{ + template <typename Initiation> + struct init_wrapper + { + init_wrapper(Initiation init) + : initiation_(BOOST_ASIO_MOVE_CAST(Initiation)(init)) + { + } + + template <typename Handler, typename... Args> + void operator()( + BOOST_ASIO_MOVE_ARG(Handler) handler, + std::tuple<Values...> values, + BOOST_ASIO_MOVE_ARG(Args)... args) + { + BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)( + detail::consign_handler< + typename decay<Handler>::type, Values...>( + BOOST_ASIO_MOVE_CAST(Handler)(handler), + BOOST_ASIO_MOVE_CAST(std::tuple<Values...>)(values)), + BOOST_ASIO_MOVE_CAST(Args)(args)...); + } + + Initiation initiation_; + }; + + template <typename Initiation, typename RawCompletionToken, typename... Args> + static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(CompletionToken, Signatures..., + (async_initiate<CompletionToken, Signatures...>( + declval<init_wrapper<typename decay<Initiation>::type> >(), + declval<CompletionToken&>(), + declval<std::tuple<Values...> >(), + declval<BOOST_ASIO_MOVE_ARG(Args)>()...))) + initiate( + BOOST_ASIO_MOVE_ARG(Initiation) initiation, + BOOST_ASIO_MOVE_ARG(RawCompletionToken) token, + BOOST_ASIO_MOVE_ARG(Args)... args) + { + return async_initiate<CompletionToken, Signatures...>( + init_wrapper<typename decay<Initiation>::type>( + BOOST_ASIO_MOVE_CAST(Initiation)(initiation)), + token.token_, + BOOST_ASIO_MOVE_CAST(std::tuple<Values...>)(token.values_), + BOOST_ASIO_MOVE_CAST(Args)(args)...); + } +}; + +template <template <typename, typename> class Associator, + typename Handler, typename... Values, typename DefaultCandidate> +struct associator<Associator, + detail::consign_handler<Handler, Values...>, DefaultCandidate> + : Associator<Handler, DefaultCandidate> +{ + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::consign_handler<Handler, Values...>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::consign_handler<Handler, Values...>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) + { + return Associator<Handler, DefaultCandidate>::get(h.handler_, c); + } +}; + +#endif // !defined(GENERATING_DOCUMENTATION) + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_IMPL_CONSIGN_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/defer.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/defer.hpp index 0df874ab19..6d4ed402f3 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/defer.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/defer.hpp @@ -52,6 +52,15 @@ public: typename associated_allocator<handler_t>::type alloc( (get_associated_allocator)(handler)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer( + boost::asio::require(ex, execution::blocking.never), + execution::relationship.continuation, + execution::allocator(alloc) + ).execute( + boost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::prefer( boost::asio::require(ex, execution::blocking.never), @@ -59,6 +68,7 @@ public: execution::allocator(alloc)), boost::asio::detail::bind_handler( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename CompletionHandler> @@ -119,6 +129,15 @@ public: typename associated_allocator<handler_t>::type alloc( (get_associated_allocator)(handler)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer( + boost::asio::require(ex_, execution::blocking.never), + execution::relationship.continuation, + execution::allocator(alloc) + ).execute( + boost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::prefer( boost::asio::require(ex_, execution::blocking.never), @@ -126,6 +145,7 @@ public: execution::allocator(alloc)), boost::asio::detail::bind_handler( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename CompletionHandler> @@ -151,6 +171,15 @@ public: typename associated_allocator<handler_t>::type alloc( (get_associated_allocator)(handler)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer( + boost::asio::require(ex_, execution::blocking.never), + execution::relationship.continuation, + execution::allocator(alloc) + ).execute( + detail::work_dispatcher<handler_t, handler_ex_t>( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), handler_ex)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::prefer( boost::asio::require(ex_, execution::blocking.never), @@ -158,6 +187,7 @@ public: execution::allocator(alloc)), detail::work_dispatcher<handler_t, handler_ex_t>( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), handler_ex)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename CompletionHandler> @@ -233,7 +263,9 @@ template <typename Executor, BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) defer( const Executor& ex, BOOST_ASIO_MOVE_ARG(NullaryToken) token, typename constraint< - execution::is_executor<Executor>::value || is_executor<Executor>::value + (execution::is_executor<Executor>::value + && can_require<Executor, execution::blocking_t::never_t>::value) + || is_executor<Executor>::value >::type) BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( async_initiate<NullaryToken, void()>( diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/deferred.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/deferred.hpp index 7a2b7fcd15..7ccc7d074a 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/deferred.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/deferred.hpp @@ -79,9 +79,19 @@ struct associator<Associator, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::deferred_sequence_handler<Handler, Tail>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::deferred_sequence_handler<Handler, Tail>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::deferred_sequence_handler<Handler, Tail>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/dispatch.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/dispatch.hpp index 291e50be95..4874f5725c 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/dispatch.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/dispatch.hpp @@ -50,12 +50,16 @@ public: typename associated_allocator<handler_t>::type alloc( (get_associated_allocator)(handler)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer(ex, execution::allocator(alloc)).execute( + boost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( - boost::asio::prefer(ex, - execution::blocking.possibly, - execution::allocator(alloc)), + boost::asio::prefer(ex, execution::allocator(alloc)), boost::asio::detail::bind_handler( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename CompletionHandler> @@ -116,12 +120,16 @@ public: typename associated_allocator<handler_t>::type alloc( (get_associated_allocator)(handler)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer(ex_, execution::allocator(alloc)).execute( + boost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( - boost::asio::prefer(ex_, - execution::blocking.possibly, - execution::allocator(alloc)), + boost::asio::prefer(ex_, execution::allocator(alloc)), boost::asio::detail::bind_handler( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename CompletionHandler> @@ -147,12 +155,16 @@ public: typename associated_allocator<handler_t>::type alloc( (get_associated_allocator)(handler)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer(ex_, execution::allocator(alloc)).execute( + detail::work_dispatcher<handler_t, handler_ex_t>( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), handler_ex)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( - boost::asio::prefer(ex_, - execution::blocking.possibly, - execution::allocator(alloc)), + boost::asio::prefer(ex_, execution::allocator(alloc)), detail::work_dispatcher<handler_t, handler_ex_t>( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), handler_ex)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename CompletionHandler> diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/handler_alloc_hook.ipp b/contrib/restricted/boost/asio/include/boost/asio/impl/handler_alloc_hook.ipp index a44e278b90..7dbe10b39f 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/handler_alloc_hook.ipp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/handler_alloc_hook.ipp @@ -52,7 +52,7 @@ asio_handler_deallocate(void* pointer, std::size_t size, ...) detail::thread_context::top_of_thread_call_stack(), pointer, size); #else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) (void)size; - aligned_delete(pointer) + aligned_delete(pointer); #endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING) } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/post.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/post.hpp index 093e90ba56..d2219d3e59 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/post.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/post.hpp @@ -52,6 +52,15 @@ public: typename associated_allocator<handler_t>::type alloc( (get_associated_allocator)(handler)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer( + boost::asio::require(ex, execution::blocking.never), + execution::relationship.fork, + execution::allocator(alloc) + ).execute( + boost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::prefer( boost::asio::require(ex, execution::blocking.never), @@ -59,6 +68,7 @@ public: execution::allocator(alloc)), boost::asio::detail::bind_handler( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename CompletionHandler> @@ -119,6 +129,15 @@ public: typename associated_allocator<handler_t>::type alloc( (get_associated_allocator)(handler)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer( + boost::asio::require(ex_, execution::blocking.never), + execution::relationship.fork, + execution::allocator(alloc) + ).execute( + boost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::prefer( boost::asio::require(ex_, execution::blocking.never), @@ -126,6 +145,7 @@ public: execution::allocator(alloc)), boost::asio::detail::bind_handler( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename CompletionHandler> @@ -151,6 +171,15 @@ public: typename associated_allocator<handler_t>::type alloc( (get_associated_allocator)(handler)); +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::prefer( + boost::asio::require(ex_, execution::blocking.never), + execution::relationship.fork, + execution::allocator(alloc) + ).execute( + detail::work_dispatcher<handler_t, handler_ex_t>( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), handler_ex)); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::prefer( boost::asio::require(ex_, execution::blocking.never), @@ -158,6 +187,7 @@ public: execution::allocator(alloc)), detail::work_dispatcher<handler_t, handler_ex_t>( BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), handler_ex)); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } template <typename CompletionHandler> @@ -233,7 +263,9 @@ template <typename Executor, BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) post( const Executor& ex, BOOST_ASIO_MOVE_ARG(NullaryToken) token, typename constraint< - execution::is_executor<Executor>::value || is_executor<Executor>::value + (execution::is_executor<Executor>::value + && can_require<Executor, execution::blocking_t::never_t>::value) + || is_executor<Executor>::value >::type) BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( async_initiate<NullaryToken, void()>( diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/prepend.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/prepend.hpp index fce4e53deb..0357280a51 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/prepend.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/prepend.hpp @@ -200,9 +200,18 @@ struct associator<Associator, detail::prepend_handler<Handler, Values...>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::prepend_handler<Handler, Values...>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::prepend_handler<Handler, Values...>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::prepend_handler<Handler, Values...>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/read.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/read.hpp index 615800faea..ae99b019ed 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/read.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/read.hpp @@ -547,10 +547,21 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_op<AsyncReadStream, MutableBufferSequence, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_op<AsyncReadStream, MutableBufferSequence, + MutableBufferIterator, CompletionCondition, ReadHandler>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_op<AsyncReadStream, MutableBufferSequence, MutableBufferIterator, CompletionCondition, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -835,10 +846,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_dynbuf_v1_op<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_dynbuf_v1_op<AsyncReadStream, DynamicBuffer_v1, + CompletionCondition, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_dynbuf_v1_op<AsyncReadStream, DynamicBuffer_v1, CompletionCondition, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -1178,10 +1199,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_dynbuf_v2_op<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_dynbuf_v2_op<AsyncReadStream, DynamicBuffer_v2, + CompletionCondition, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_dynbuf_v2_op<AsyncReadStream, DynamicBuffer_v2, CompletionCondition, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/read_at.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/read_at.hpp index 2777eb84e4..643ad7a69b 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/read_at.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/read_at.hpp @@ -407,11 +407,22 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_at_op<AsyncRandomAccessReadDevice, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_at_op<AsyncRandomAccessReadDevice, + MutableBufferSequence, MutableBufferIterator, + CompletionCondition, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, MutableBufferIterator, CompletionCondition, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -687,10 +698,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, + Executor, CompletionCondition, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Executor, CompletionCondition, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/read_until.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/read_until.hpp index 4ae06750a5..5b35890a28 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/read_until.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/read_until.hpp @@ -1060,10 +1060,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_until_delim_op_v1<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_until_delim_op_v1<AsyncReadStream, + DynamicBuffer_v1, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_until_delim_op_v1<AsyncReadStream, DynamicBuffer_v1, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -1367,10 +1377,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_until_delim_string_op_v1<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_until_delim_string_op_v1<AsyncReadStream, + DynamicBuffer_v1, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_until_delim_string_op_v1<AsyncReadStream, DynamicBuffer_v1, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -1683,10 +1703,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_until_expr_op_v1<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_until_expr_op_v1<AsyncReadStream, + DynamicBuffer_v1, RegEx, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_until_expr_op_v1<AsyncReadStream, DynamicBuffer_v1, RegEx, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -1995,10 +2025,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_until_match_op_v1<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_until_match_op_v1<AsyncReadStream, + DynamicBuffer_v1, MatchCondition, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_until_match_op_v1<AsyncReadStream, DynamicBuffer_v1, MatchCondition, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -2380,10 +2420,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_until_delim_op_v2<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_until_delim_op_v2<AsyncReadStream, + DynamicBuffer_v2, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_until_delim_op_v2<AsyncReadStream, DynamicBuffer_v2, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -2691,10 +2741,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_until_delim_string_op_v2<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_until_delim_string_op_v2<AsyncReadStream, + DynamicBuffer_v2, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_until_delim_string_op_v2<AsyncReadStream, DynamicBuffer_v2, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -3013,10 +3073,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_until_expr_op_v2<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_until_expr_op_v2<AsyncReadStream, + DynamicBuffer_v2, RegEx, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_until_expr_op_v2<AsyncReadStream, DynamicBuffer_v2, RegEx, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } @@ -3328,10 +3398,20 @@ struct associator<Associator, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { - static typename Associator<ReadHandler, DefaultCandidate>::type get( - const detail::read_until_match_op_v2<AsyncReadStream, + static typename Associator<ReadHandler, DefaultCandidate>::type + get(const detail::read_until_match_op_v2<AsyncReadStream, + DynamicBuffer_v2, MatchCondition, ReadHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<ReadHandler, DefaultCandidate>::type) + get(const detail::read_until_match_op_v2<AsyncReadStream, DynamicBuffer_v2, MatchCondition, ReadHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/redirect_error.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/redirect_error.hpp index ea886a961f..55a366bb21 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/redirect_error.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/redirect_error.hpp @@ -593,9 +593,18 @@ struct associator<Associator, detail::redirect_error_handler<Handler>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const detail::redirect_error_handler<Handler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const detail::redirect_error_handler<Handler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const detail::redirect_error_handler<Handler>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/spawn.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/spawn.hpp index db91db118b..f03c0c6a97 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/spawn.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/spawn.hpp @@ -22,6 +22,7 @@ #include <boost/asio/async_result.hpp> #include <boost/asio/bind_executor.hpp> #include <boost/asio/detail/atomic_count.hpp> +#include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> @@ -46,6 +47,14 @@ namespace boost { namespace asio { namespace detail { +#if !defined(BOOST_ASIO_NO_EXCEPTIONS) +inline void spawned_thread_rethrow(void* ex) +{ + if (*static_cast<exception_ptr*>(ex)) + rethrow_exception(*static_cast<exception_ptr*>(ex)); +} +#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) + #if defined(BOOST_ASIO_HAS_BOOST_COROUTINE) // Spawned thread implementation using Boost.Coroutine. @@ -118,6 +127,8 @@ public: { callee_type callee; callee.swap(callee_); + if (terminal_) + callee(); } private: @@ -140,8 +151,26 @@ private: *spawned_thread_out_ = &spawned_thread; spawned_thread_out_ = 0; spawned_thread.suspend(); - function(&spawned_thread); - spawned_thread.suspend(); +#if !defined(BOOST_ASIO_NO_EXCEPTIONS) + try +#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) + { + function(&spawned_thread); + spawned_thread.terminal_ = true; + spawned_thread.suspend(); + } +#if !defined(BOOST_ASIO_NO_EXCEPTIONS) + catch (const boost::coroutines::detail::forced_unwind&) + { + throw; + } + catch (...) + { + exception_ptr ex = current_exception(); + spawned_thread.terminal_ = true; + spawned_thread.suspend_with(spawned_thread_rethrow, &ex); + } +#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) } private: @@ -226,7 +255,8 @@ public: void destroy() { fiber_type callee = BOOST_ASIO_MOVE_CAST(fiber_type)(callee_); - (void)callee; + if (terminal_) + fiber_type(BOOST_ASIO_MOVE_CAST(fiber_type)(callee)).resume(); } private: @@ -250,9 +280,27 @@ private: *spawned_thread_out_ = &spawned_thread; spawned_thread_out_ = 0; spawned_thread.suspend(); - function(&spawned_thread); - spawned_thread.suspend(); - return {}; +#if !defined(BOOST_ASIO_NO_EXCEPTIONS) + try +#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) + { + function(&spawned_thread); + spawned_thread.terminal_ = true; + spawned_thread.suspend(); + } +#if !defined(BOOST_ASIO_NO_EXCEPTIONS) + catch (const boost::context::detail::forced_unwind&) + { + throw; + } + catch (...) + { + exception_ptr ex = current_exception(); + spawned_thread.terminal_ = true; + spawned_thread.suspend_with(spawned_thread_rethrow, &ex); + } +#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) + return BOOST_ASIO_MOVE_CAST(fiber_type)(spawned_thread.caller_); } private: @@ -963,7 +1011,8 @@ public: BOOST_ASIO_MOVE_ARG(F) f, BOOST_ASIO_MOVE_ARG(H) h) : executor_(ex), function_(BOOST_ASIO_MOVE_CAST(F)(f)), - handler_(BOOST_ASIO_MOVE_CAST(H)(h)) + handler_(BOOST_ASIO_MOVE_CAST(H)(h)), + work_(handler_, executor_) { } @@ -985,7 +1034,9 @@ private: function_(yield); if (!yield.spawned_thread_->has_context_switched()) (post)(yield); - BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler_)(exception_ptr()); + detail::binder1<Handler, exception_ptr> + handler(handler_, exception_ptr()); + work_.complete(handler, handler.handler_); } #if !defined(BOOST_ASIO_NO_EXCEPTIONS) # if defined(BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER) @@ -1005,7 +1056,8 @@ private: exception_ptr ex = current_exception(); if (!yield.spawned_thread_->has_context_switched()) (post)(yield); - BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler_)(ex); + detail::binder1<Handler, exception_ptr> handler(handler_, ex); + work_.complete(handler, handler.handler_); } #endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) } @@ -1020,8 +1072,9 @@ private: T result(function_(yield)); if (!yield.spawned_thread_->has_context_switched()) (post)(yield); - BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler_)( - exception_ptr(), BOOST_ASIO_MOVE_CAST(T)(result)); + detail::binder2<Handler, exception_ptr, T> + handler(handler_, exception_ptr(), BOOST_ASIO_MOVE_CAST(T)(result)); + work_.complete(handler, handler.handler_); } #if !defined(BOOST_ASIO_NO_EXCEPTIONS) # if defined(BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER) @@ -1041,7 +1094,8 @@ private: exception_ptr ex = current_exception(); if (!yield.spawned_thread_->has_context_switched()) (post)(yield); - BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler_)(ex, T()); + detail::binder2<Handler, exception_ptr, T> handler(handler_, ex, T()); + work_.complete(handler, handler.handler_); } #endif // !defined(BOOST_ASIO_NO_EXCEPTIONS) } @@ -1049,6 +1103,7 @@ private: Executor executor_; Function function_; Handler handler_; + handler_work<Handler, Executor> work_; }; struct spawn_cancellation_signal_emitter @@ -1066,8 +1121,8 @@ template <typename Handler, typename Executor, typename = void> class spawn_cancellation_handler { public: - spawn_cancellation_handler(const Handler& handler, const Executor& ex) - : ex_(boost::asio::get_associated_executor(handler, ex)) + spawn_cancellation_handler(const Handler&, const Executor& ex) + : ex_(ex) { } @@ -1084,7 +1139,7 @@ public: private: cancellation_signal signal_; - typename associated_executor<Handler, Executor>::type ex_; + Executor ex_; }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/src.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/src.hpp index 2df92d9987..f448e33207 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/src.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/src.hpp @@ -19,6 +19,7 @@ # error Do not compile Asio library source with BOOST_ASIO_HEADER_ONLY defined #endif +#include <boost/asio/impl/any_completion_executor.ipp> #include <boost/asio/impl/any_io_executor.ipp> #include <boost/asio/impl/cancellation_signal.ipp> #include <boost/asio/impl/connect_pipe.ipp> diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/use_future.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/use_future.hpp index 4e55d3ccb2..6e15e27028 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/use_future.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/use_future.hpp @@ -212,6 +212,11 @@ public: { } + execution_context& query(execution::context_t) const BOOST_ASIO_NOEXCEPT + { + return boost::asio::query(system_executor(), execution::context); + } + static BOOST_ASIO_CONSTEXPR Blocking query(execution::blocking_t) { return Blocking(); @@ -232,9 +237,14 @@ public: template <typename F> void execute(BOOST_ASIO_MOVE_ARG(F) f) const { +#if defined(BOOST_ASIO_NO_DEPRECATED) + boost::asio::require(system_executor(), Blocking()).execute( + promise_invoker<T, F>(p_, BOOST_ASIO_MOVE_CAST(F)(f))); +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::execute( boost::asio::require(system_executor(), Blocking()), promise_invoker<T, F>(p_, BOOST_ASIO_MOVE_CAST(F)(f))); +#endif // defined(BOOST_ASIO_NO_DEPRECATED) } #if !defined(BOOST_ASIO_NO_TS_EXECUTORS) @@ -990,6 +1000,21 @@ struct query_static_constexpr_member< #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_TRAIT) +#if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) + +template <typename T, typename Blocking> +struct query_member< + boost::asio::detail::promise_executor<T, Blocking>, + execution::context_t + > +{ + BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true); + BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); + typedef boost::asio::system_context& result_type; +}; + +#endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) + #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) template <typename T, typename Blocking> diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/write.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/write.hpp index fae7f3b164..07236b0899 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/write.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/write.hpp @@ -512,10 +512,21 @@ struct associator<Associator, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { - static typename Associator<WriteHandler, DefaultCandidate>::type get( - const detail::write_op<AsyncWriteStream, ConstBufferSequence, + static typename Associator<WriteHandler, DefaultCandidate>::type + get(const detail::write_op<AsyncWriteStream, ConstBufferSequence, + ConstBufferIterator, CompletionCondition, WriteHandler>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<WriteHandler, DefaultCandidate>::type) + get(const detail::write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } @@ -758,10 +769,20 @@ struct associator<Associator, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { - static typename Associator<WriteHandler, DefaultCandidate>::type get( - const detail::write_dynbuf_v1_op<AsyncWriteStream, + static typename Associator<WriteHandler, DefaultCandidate>::type + get(const detail::write_dynbuf_v1_op<AsyncWriteStream, DynamicBuffer_v1, + CompletionCondition, WriteHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<WriteHandler, DefaultCandidate>::type) + get(const detail::write_dynbuf_v1_op<AsyncWriteStream, DynamicBuffer_v1, CompletionCondition, WriteHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } @@ -1055,35 +1076,22 @@ struct associator<Associator, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { - static typename Associator<WriteHandler, DefaultCandidate>::type get( - const detail::write_dynbuf_v2_op<AsyncWriteStream, - DynamicBuffer_v2, CompletionCondition, WriteHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<WriteHandler, DefaultCandidate>::type + get(const detail::write_dynbuf_v2_op<AsyncWriteStream, DynamicBuffer_v2, + CompletionCondition, WriteHandler>& h) BOOST_ASIO_NOEXCEPT { - return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); + return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); } -}; - -template <typename AsyncWriteStream, typename DynamicBuffer_v2, - typename CompletionCondition, typename WriteHandler, - typename CancellationSlot> -struct associated_cancellation_slot< - detail::write_dynbuf_v2_op<AsyncWriteStream, - DynamicBuffer_v2, CompletionCondition, WriteHandler>, - CancellationSlot> - : detail::associated_cancellation_slot_forwarding_base< - WriteHandler, CancellationSlot> -{ - typedef typename associated_cancellation_slot< - WriteHandler, CancellationSlot>::type type; - static type get( - const detail::write_dynbuf_v2_op<AsyncWriteStream, + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<WriteHandler, DefaultCandidate>::type) + get(const detail::write_dynbuf_v2_op<AsyncWriteStream, DynamicBuffer_v2, CompletionCondition, WriteHandler>& h, - const CancellationSlot& s = CancellationSlot()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c))) { - return associated_cancellation_slot<WriteHandler, - CancellationSlot>::get(h.handler_, s); + return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } }; diff --git a/contrib/restricted/boost/asio/include/boost/asio/impl/write_at.hpp b/contrib/restricted/boost/asio/include/boost/asio/impl/write_at.hpp index 63689f46cf..4c3afdba3e 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/impl/write_at.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/impl/write_at.hpp @@ -392,11 +392,22 @@ struct associator<Associator, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { - static typename Associator<WriteHandler, DefaultCandidate>::type get( - const detail::write_at_op<AsyncRandomAccessWriteDevice, + static typename Associator<WriteHandler, DefaultCandidate>::type + get(const detail::write_at_op<AsyncRandomAccessWriteDevice, + ConstBufferSequence, ConstBufferIterator, + CompletionCondition, WriteHandler>& h) BOOST_ASIO_NOEXCEPT + { + return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<WriteHandler, DefaultCandidate>::type) + get(const detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } @@ -599,9 +610,19 @@ struct associator<Associator, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { - static typename Associator<WriteHandler, DefaultCandidate>::type get( - const detail::write_at_streambuf_op<Executor, WriteHandler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<WriteHandler, DefaultCandidate>::type + get(const detail::write_at_streambuf_op<Executor, WriteHandler>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<WriteHandler, DefaultCandidate>::type) + get(const detail::write_at_streambuf_op<Executor, WriteHandler>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c))) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/io_context.hpp b/contrib/restricted/boost/asio/include/boost/asio/io_context.hpp index 0da8ccbaa0..23bec2cdf7 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/io_context.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/io_context.hpp @@ -1006,20 +1006,7 @@ public: || static_cast<const Allocator&>(a) != static_cast<const Allocator&>(b); } -#if !defined(GENERATING_DOCUMENTATION) -private: - friend struct boost_asio_execution_execute_fn::impl; -#endif // !defined(GENERATING_DOCUMENTATION) - /// Execution function. - /** - * Do not call this function directly. It is intended for use with the - * execution::execute customisation point. - * - * For example: - * @code auto ex = my_io_context.get_executor(); - * execution::execute(ex, my_function_object); @endcode - */ template <typename Function> void execute(BOOST_ASIO_MOVE_ARG(Function) f) const; diff --git a/contrib/restricted/boost/asio/include/boost/asio/posix/basic_descriptor.hpp b/contrib/restricted/boost/asio/include/boost/asio/posix/basic_descriptor.hpp index 9f14fa6d6a..d17814deea 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/posix/basic_descriptor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/posix/basic_descriptor.hpp @@ -253,7 +253,7 @@ public: #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -748,7 +748,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/posix/basic_stream_descriptor.hpp b/contrib/restricted/boost/asio/include/boost/asio/posix/basic_stream_descriptor.hpp index aa68c2bc3c..9508d6e674 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/posix/basic_stream_descriptor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/posix/basic_stream_descriptor.hpp @@ -502,7 +502,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -535,7 +535,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/post.hpp b/contrib/restricted/boost/asio/include/boost/asio/post.hpp index 738ab2319e..7dc4343f98 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/post.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/post.hpp @@ -19,8 +19,10 @@ #include <boost/asio/async_result.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution_context.hpp> +#include <boost/asio/execution/blocking.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/is_executor.hpp> +#include <boost/asio/require.hpp> #include <boost/asio/detail/push_options.hpp> @@ -66,12 +68,11 @@ template <typename> class initiate_post_with_executor; * @code auto alloc = get_associated_allocator(handler); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs - * @code execution::execute( - * prefer( - * require(ex, execution::blocking.never), - * execution::relationship.fork, - * execution::allocator(alloc)), - * std::forward<CompletionHandler>(completion_handler)); @endcode + * @code prefer( + * require(ex, execution::blocking.never), + * execution::relationship.fork, + * execution::allocator(alloc) + * ).execute(std::forward<CompletionHandler>(completion_handler)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs * @code ex.post( @@ -133,11 +134,8 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) post( * handler_ that is a decay-copy of @c completion_handler, and a function call * operator that performs: * @code auto a = get_associated_allocator(handler_); - * execution::execute( - * prefer(executor_, - * execution::blocking.possibly, - * execution::allocator(a)), - * std::move(handler_)); @endcode + * prefer(executor_, execution::allocator(a)).execute(std::move(handler_)); + * @endcode * * @li If <tt>execution::is_executor<Ex1>::value</tt> is false, constructs a * function object @c f with a member @c work_ that is initialised with @@ -148,12 +146,11 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) post( * work_.reset(); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs - * @code execution::execute( - * prefer( - * require(ex, execution::blocking.never), - * execution::relationship.fork, - * execution::allocator(alloc)), - * std::move(f)); @endcode + * @code prefer( + * require(ex, execution::blocking.never), + * execution::relationship.fork, + * execution::allocator(alloc) + * ).execute(std::move(f)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs * @code ex.post(std::move(f), alloc); @endcode @@ -169,7 +166,9 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) post( BOOST_ASIO_MOVE_ARG(NullaryToken) token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(Executor), typename constraint< - execution::is_executor<Executor>::value || is_executor<Executor>::value + (execution::is_executor<Executor>::value + && can_require<Executor, execution::blocking_t::never_t>::value) + || is_executor<Executor>::value >::type = 0) BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( async_initiate<NullaryToken, void()>( diff --git a/contrib/restricted/boost/asio/include/boost/asio/spawn.hpp b/contrib/restricted/boost/asio/include/boost/asio/spawn.hpp index 04a228b9ae..3c25eb58f2 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/spawn.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/spawn.hpp @@ -43,7 +43,8 @@ public: spawned_thread_base() : owner_(0), has_context_switched_(false), - throw_if_cancelled_(false) + throw_if_cancelled_(false), + terminal_(false) { } @@ -131,6 +132,7 @@ protected: boost::asio::cancellation_state cancellation_state_; bool has_context_switched_; bool throw_if_cancelled_; + bool terminal_; private: // Disallow copying and assignment. diff --git a/contrib/restricted/boost/asio/include/boost/asio/ssl/detail/io.hpp b/contrib/restricted/boost/asio/include/boost/asio/ssl/detail/io.hpp index fd58635fb4..43603c61b3 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/ssl/detail/io.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/ssl/detail/io.hpp @@ -411,9 +411,19 @@ struct associator<Associator, DefaultCandidate> : Associator<Handler, DefaultCandidate> { - static typename Associator<Handler, DefaultCandidate>::type get( - const ssl::detail::io_op<Stream, Operation, Handler>& h, - const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT + static typename Associator<Handler, DefaultCandidate>::type + get(const ssl::detail::io_op<Stream, Operation, Handler>& h) + BOOST_ASIO_NOEXCEPT + { + return Associator<Handler, DefaultCandidate>::get(h.handler_); + } + + static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( + typename Associator<Handler, DefaultCandidate>::type) + get(const ssl::detail::io_op<Stream, Operation, Handler>& h, + const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT + BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( + Associator<Handler, DefaultCandidate>::get(h.handler_, c))) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/strand.hpp b/contrib/restricted/boost/asio/include/boost/asio/strand.hpp index 041d891fa2..e6e5a1aa89 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/strand.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/strand.hpp @@ -263,13 +263,6 @@ public: /// Request the strand to invoke the given function object. /** - * Do not call this function directly. It is intended for use with the - * execution::execute customisation point. - * - * For example: - * @code boost::asio::strand<my_executor_type> ex = ...; - * execution::execute(ex, my_function_object); @endcode - * * This function is used to ask the strand to execute the given function * object on its underlying executor. The function object will be executed * according to the properties of the underlying executor. @@ -280,7 +273,14 @@ public: */ template <typename Function> typename constraint< +#if defined(BOOST_ASIO_NO_DEPRECATED) \ + || defined(GENERATING_DOCUMENTATION) + traits::execute_member<const Executor&, Function>::is_valid, +#else // defined(BOOST_ASIO_NO_DEPRECATED) + // || defined(GENERATING_DOCUMENTATION) execution::can_execute<const Executor&, Function>::value, +#endif // defined(BOOST_ASIO_NO_DEPRECATED) + // || defined(GENERATING_DOCUMENTATION) void >::type execute(BOOST_ASIO_MOVE_ARG(Function) f) const { @@ -495,7 +495,11 @@ struct equality_comparable<strand<Executor> > template <typename Executor, typename Function> struct execute_member<strand<Executor>, Function, typename enable_if< +#if defined(BOOST_ASIO_NO_DEPRECATED) + traits::execute_member<const Executor&, Function>::is_valid +#else // defined(BOOST_ASIO_NO_DEPRECATED) execution::can_execute<const Executor&, Function>::value +#endif // defined(BOOST_ASIO_NO_DEPRECATED) >::type> { BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true); diff --git a/contrib/restricted/boost/asio/include/boost/asio/system_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/system_executor.hpp index e84b5ba49d..6ebf8799b1 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/system_executor.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/system_executor.hpp @@ -315,20 +315,7 @@ public: return false; } -#if !defined(GENERATING_DOCUMENTATION) -private: - friend struct boost_asio_execution_execute_fn::impl; -#endif // !defined(GENERATING_DOCUMENTATION) - /// Execution function. - /** - * Do not call this function directly. It is intended for use with the - * execution::execute customisation point. - * - * For example: - * @code boost::asio::system_executor ex; - * execution::execute(ex, my_function_object); @endcode - */ template <typename Function> void execute(BOOST_ASIO_MOVE_ARG(Function) f) const { diff --git a/contrib/restricted/boost/asio/include/boost/asio/thread_pool.hpp b/contrib/restricted/boost/asio/include/boost/asio/thread_pool.hpp index ee551e9f1b..a33f50ed8e 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/thread_pool.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/thread_pool.hpp @@ -166,8 +166,10 @@ template <typename Allocator, unsigned int Bits> class thread_pool::basic_executor_type : detail::thread_pool_bits { public: - /// The sender type, when this type is used as a scheduler. +#if !defined(BOOST_ASIO_NO_DEPRECATED) + /// (Deprecated.) The sender type, when this type is used as a scheduler. typedef basic_executor_type sender_type; +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// The bulk execution shape type. typedef std::size_t shape_type; @@ -404,7 +406,8 @@ private: friend struct boost::asio::execution::detail::outstanding_work_t<0>; #endif // !defined(GENERATING_DOCUMENTATION) - /// Query the current value of the @c bulk_guarantee property. +#if !defined(BOOST_ASIO_NO_DEPRECATED) + /// (Deprecated.) Query the current value of the @c bulk_guarantee property. /** * Do not call this function directly. It is intended for use with the * boost::asio::query customisation point. @@ -420,6 +423,7 @@ private: { return execution::bulk_guarantee.parallel; } +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Query the current value of the @c mapping property. /** @@ -592,20 +596,7 @@ public: || a.bits_ != b.bits_; } -#if !defined(GENERATING_DOCUMENTATION) -private: - friend struct boost_asio_execution_execute_fn::impl; -#endif // !defined(GENERATING_DOCUMENTATION) - /// Execution function. - /** - * Do not call this function directly. It is intended for use with the - * execution::execute customisation point. - * - * For example: - * @code auto ex = my_thread_pool.executor(); - * execution::execute(ex, my_function_object); @endcode - */ template <typename Function> void execute(BOOST_ASIO_MOVE_ARG(Function) f) const { @@ -614,7 +605,8 @@ private: } public: - /// Bulk execution function. +#if !defined(BOOST_ASIO_NO_DEPRECATED) + /// (Deprecated.) Bulk execution function. template <typename Function> void bulk_execute(BOOST_ASIO_MOVE_ARG(Function) f, std::size_t n) const { @@ -622,7 +614,7 @@ public: integral_constant<bool, (Bits & blocking_always) != 0>()); } - /// Schedule function. + /// (Deprecated.) Schedule function. /** * Do not call this function directly. It is intended for use with the * execution::schedule customisation point. @@ -634,7 +626,7 @@ public: return *this; } - /// Connect function. + /// (Deprecated.) Connect function. /** * Do not call this function directly. It is intended for use with the * execution::connect customisation point. @@ -653,6 +645,7 @@ public: return execution::detail::as_operation<basic_executor_type, Receiver>( *this, BOOST_ASIO_MOVE_CAST(Receiver)(r)); } +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) #if !defined(BOOST_ASIO_NO_TS_EXECUTORS) /// Obtain the underlying execution context. @@ -819,6 +812,8 @@ struct execute_member< #if !defined(BOOST_ASIO_HAS_DEDUCED_SCHEDULE_MEMBER_TRAIT) +#if !defined(BOOST_ASIO_NO_DEPRECATED) + template <typename Allocator, unsigned int Bits> struct schedule_member< const boost::asio::thread_pool::basic_executor_type<Allocator, Bits> @@ -830,10 +825,14 @@ struct schedule_member< Allocator, Bits> result_type; }; +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // !defined(BOOST_ASIO_HAS_DEDUCED_SCHEDULE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_CONNECT_MEMBER_TRAIT) +#if !defined(BOOST_ASIO_NO_DEPRECATED) + template <typename Allocator, unsigned int Bits, typename Receiver> struct connect_member< const boost::asio::thread_pool::basic_executor_type<Allocator, Bits>, @@ -847,6 +846,8 @@ struct connect_member< Receiver> result_type; }; +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // !defined(BOOST_ASIO_HAS_DEDUCED_CONNECT_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) @@ -964,6 +965,8 @@ struct require_member< #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) +#if !defined(BOOST_ASIO_NO_DEPRECATED) + template <typename Allocator, unsigned int Bits, typename Property> struct query_static_constexpr_member< boost::asio::thread_pool::basic_executor_type<Allocator, Bits>, @@ -986,6 +989,8 @@ struct query_static_constexpr_member< } }; +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + template <typename Allocator, unsigned int Bits, typename Property> struct query_static_constexpr_member< boost::asio::thread_pool::basic_executor_type<Allocator, Bits>, diff --git a/contrib/restricted/boost/asio/include/boost/asio/version.hpp b/contrib/restricted/boost/asio/include/boost/asio/version.hpp index 70c78351e0..f5be3dc485 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/version.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/version.hpp @@ -18,6 +18,6 @@ // BOOST_ASIO_VERSION % 100 is the sub-minor version // BOOST_ASIO_VERSION / 100 % 1000 is the minor version // BOOST_ASIO_VERSION / 100000 is the major version -#define BOOST_ASIO_VERSION 102400 // 1.24.0 +#define BOOST_ASIO_VERSION 102600 // 1.26.0 #endif // BOOST_ASIO_VERSION_HPP diff --git a/contrib/restricted/boost/asio/include/boost/asio/windows/basic_object_handle.hpp b/contrib/restricted/boost/asio/include/boost/asio/windows/basic_object_handle.hpp index d8ad02951b..c101abf3ad 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/windows/basic_object_handle.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/windows/basic_object_handle.hpp @@ -238,7 +238,7 @@ public: #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } @@ -457,7 +457,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/windows/basic_overlapped_handle.hpp b/contrib/restricted/boost/asio/include/boost/asio/windows/basic_overlapped_handle.hpp index 575aa16c63..ea61548a37 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/windows/basic_overlapped_handle.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/windows/basic_overlapped_handle.hpp @@ -239,7 +239,7 @@ public: #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the executor associated with the object. - executor_type get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() BOOST_ASIO_NOEXCEPT { return impl_.get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/windows/basic_random_access_handle.hpp b/contrib/restricted/boost/asio/include/boost/asio/windows/basic_random_access_handle.hpp index 16f2a24457..93033f493e 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/windows/basic_random_access_handle.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/windows/basic_random_access_handle.hpp @@ -512,7 +512,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -545,7 +545,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/include/boost/asio/windows/basic_stream_handle.hpp b/contrib/restricted/boost/asio/include/boost/asio/windows/basic_stream_handle.hpp index bc0392287c..2471e172b9 100644 --- a/contrib/restricted/boost/asio/include/boost/asio/windows/basic_stream_handle.hpp +++ b/contrib/restricted/boost/asio/include/boost/asio/windows/basic_stream_handle.hpp @@ -494,7 +494,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } @@ -527,7 +527,7 @@ private: { } - executor_type get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT { return self_->get_executor(); } diff --git a/contrib/restricted/boost/asio/ya.make b/contrib/restricted/boost/asio/ya.make index d2ddf6035a..53948d3850 100644 --- a/contrib/restricted/boost/asio/ya.make +++ b/contrib/restricted/boost/asio/ya.make @@ -9,9 +9,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.80.0) +VERSION(1.81.0) -ORIGINAL_SOURCE(https://github.com/boostorg/asio/archive/boost-1.80.0.tar.gz) +ORIGINAL_SOURCE(https://github.com/boostorg/asio/archive/boost-1.81.0.tar.gz) PEERDIR( contrib/libs/openssl |