aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-11-07 22:50:04 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-11-07 23:00:17 +0300
commitd79b57a946339b6f09b76ebdc2e70addfbb00baa (patch)
tree8085b7866067843c89dd61d0236a0ef416794117
parent77acc99aab41efa1d6cf64879057312292355860 (diff)
downloadydb-d79b57a946339b6f09b76ebdc2e70addfbb00baa.tar.gz
Update contrib/restricted/boost/asio to 1.83.0
commit_hash:446591731b6d2e1a84e00faebd59f2706866b6e1
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/any_completion_handler.hpp61
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/bind_allocator.hpp34
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/bind_cancellation_slot.hpp34
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/bind_immediate_executor.hpp37
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/compose.hpp7
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp25
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/detail/dev_poll_reactor.hpp3
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/detail/impl/io_uring_service.ipp61
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/detail/impl/signal_set_service.ipp2
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/detail/memory.hpp2
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_service_base.hpp4
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/execution/any_executor.hpp60
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/experimental/basic_channel.hpp2
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/experimental/basic_concurrent_channel.hpp2
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/experimental/co_composed.hpp5
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/experimental/impl/coro.hpp50
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/impl/as_tuple.hpp46
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/impl/co_spawn.hpp140
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/impl/spawn.hpp4
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/ip/bad_address_cast.hpp10
-rw-r--r--contrib/restricted/boost/asio/include/boost/asio/version.hpp2
-rw-r--r--contrib/restricted/boost/asio/ya.make4
22 files changed, 433 insertions, 162 deletions
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
index ae73387ebd..3164492dd4 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/any_completion_handler.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/any_completion_handler.hpp
@@ -23,9 +23,11 @@
#include <memory>
#include <utility>
#include <boost/asio/any_completion_executor.hpp>
+#include <boost/asio/any_io_executor.hpp>
#include <boost/asio/associated_allocator.hpp>
#include <boost/asio/associated_cancellation_slot.hpp>
#include <boost/asio/associated_executor.hpp>
+#include <boost/asio/associated_immediate_executor.hpp>
#include <boost/asio/cancellation_state.hpp>
#include <boost/asio/recycling_allocator.hpp>
@@ -126,6 +128,13 @@ public:
(get_associated_executor)(handler_, candidate));
}
+ any_completion_executor immediate_executor(
+ const any_io_executor& candidate) const BOOST_ASIO_NOEXCEPT
+ {
+ return any_completion_executor(std::nothrow,
+ (get_associated_immediate_executor)(handler_, candidate));
+ }
+
void* allocate(std::size_t size, std::size_t align) const
{
typename std::allocator_traits<
@@ -306,6 +315,36 @@ private:
type executor_fn_;
};
+class any_completion_handler_immediate_executor_fn
+{
+public:
+ using type = any_completion_executor(*)(
+ any_completion_handler_impl_base*, const any_io_executor&);
+
+ constexpr any_completion_handler_immediate_executor_fn(type fn)
+ : immediate_executor_fn_(fn)
+ {
+ }
+
+ any_completion_executor immediate_executor(
+ any_completion_handler_impl_base* impl,
+ const any_io_executor& candidate) const
+ {
+ return immediate_executor_fn_(impl, candidate);
+ }
+
+ template <typename Handler>
+ static any_completion_executor impl(any_completion_handler_impl_base* impl,
+ const any_io_executor& candidate)
+ {
+ return static_cast<any_completion_handler_impl<Handler>*>(
+ impl)->immediate_executor(candidate);
+ }
+
+private:
+ type immediate_executor_fn_;
+};
+
class any_completion_handler_allocate_fn
{
public:
@@ -368,6 +407,7 @@ 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_immediate_executor_fn,
private any_completion_handler_allocate_fn,
private any_completion_handler_deallocate_fn,
private any_completion_handler_call_fns<Signatures...>
@@ -377,11 +417,13 @@ public:
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_immediate_executor_fn::type immediate_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_immediate_executor_fn(immediate_executor_fn),
any_completion_handler_allocate_fn(allocate_fn),
any_completion_handler_deallocate_fn(deallocate_fn),
any_completion_handler_call_fns<Signatures...>(call_fns...)
@@ -390,6 +432,7 @@ public:
using any_completion_handler_destroy_fn::destroy;
using any_completion_handler_executor_fn::executor;
+ using any_completion_handler_immediate_executor_fn::immediate_executor;
using any_completion_handler_allocate_fn::allocate;
using any_completion_handler_deallocate_fn::deallocate;
using any_completion_handler_call_fns<Signatures...>::call;
@@ -402,6 +445,7 @@ struct any_completion_handler_fn_table_instance
value = any_completion_handler_fn_table<Signatures...>(
&any_completion_handler_destroy_fn::impl<Handler>,
&any_completion_handler_executor_fn::impl<Handler>,
+ &any_completion_handler_immediate_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>...);
@@ -577,6 +621,9 @@ private:
template <typename, typename>
friend struct associated_executor;
+ template <typename, typename>
+ friend struct associated_immediate_executor;
+
const detail::any_completion_handler_fn_table<Signatures...>* fn_table_;
detail::any_completion_handler_impl_base* impl_;
#endif // !defined(GENERATING_DOCUMENTATION)
@@ -751,6 +798,20 @@ struct associated_executor<any_completion_handler<Signatures...>, Candidate>
}
};
+template <typename... Signatures, typename Candidate>
+struct associated_immediate_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_->immediate_executor(handler.impl_,
+ any_io_executor(std::nothrow, candidate));
+ }
+};
+
} // namespace asio
} // namespace boost
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 49bb2c7f43..8123f1fac8 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/bind_allocator.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/bind_allocator.hpp
@@ -472,20 +472,40 @@ namespace detail {
template <typename TargetAsyncResult,
typename Allocator, typename = void>
-struct allocator_binder_async_result_completion_handler_type
+class allocator_binder_completion_handler_async_result
{
+public:
+ template <typename T>
+ explicit allocator_binder_completion_handler_async_result(T&)
+ {
+ }
};
template <typename TargetAsyncResult, typename Allocator>
-struct allocator_binder_async_result_completion_handler_type<
+class allocator_binder_completion_handler_async_result<
TargetAsyncResult, Allocator,
typename void_type<
typename TargetAsyncResult::completion_handler_type
>::type>
{
+public:
typedef allocator_binder<
typename TargetAsyncResult::completion_handler_type, Allocator>
completion_handler_type;
+
+ explicit allocator_binder_completion_handler_async_result(
+ typename TargetAsyncResult::completion_handler_type& handler)
+ : target_(handler)
+ {
+ }
+
+ typename TargetAsyncResult::return_type get()
+ {
+ return target_.get();
+ }
+
+private:
+ TargetAsyncResult target_;
};
template <typename TargetAsyncResult, typename = void>
@@ -507,22 +527,18 @@ struct allocator_binder_async_result_return_type<
template <typename T, typename Allocator, typename Signature>
class async_result<allocator_binder<T, Allocator>, Signature> :
- public detail::allocator_binder_async_result_completion_handler_type<
+ public detail::allocator_binder_completion_handler_async_result<
async_result<T, Signature>, Allocator>,
public detail::allocator_binder_async_result_return_type<
async_result<T, Signature> >
{
public:
explicit async_result(allocator_binder<T, Allocator>& b)
- : target_(b.get())
+ : detail::allocator_binder_completion_handler_async_result<
+ async_result<T, Signature>, Allocator>(b.get())
{
}
- typename async_result<T, Signature>::return_type get()
- {
- return target_.get();
- }
-
template <typename Initiation>
struct init_wrapper
{
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 91e97cf1ad..19f3af8dac 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
@@ -474,20 +474,40 @@ namespace detail {
template <typename TargetAsyncResult,
typename CancellationSlot, typename = void>
-struct cancellation_slot_binder_async_result_completion_handler_type
+class cancellation_slot_binder_completion_handler_async_result
{
+public:
+ template <typename T>
+ explicit cancellation_slot_binder_completion_handler_async_result(T&)
+ {
+ }
};
template <typename TargetAsyncResult, typename CancellationSlot>
-struct cancellation_slot_binder_async_result_completion_handler_type<
+class cancellation_slot_binder_completion_handler_async_result<
TargetAsyncResult, CancellationSlot,
typename void_type<
typename TargetAsyncResult::completion_handler_type
>::type>
{
+public:
typedef cancellation_slot_binder<
typename TargetAsyncResult::completion_handler_type, CancellationSlot>
completion_handler_type;
+
+ explicit cancellation_slot_binder_completion_handler_async_result(
+ typename TargetAsyncResult::completion_handler_type& handler)
+ : target_(handler)
+ {
+ }
+
+ typename TargetAsyncResult::return_type get()
+ {
+ return target_.get();
+ }
+
+private:
+ TargetAsyncResult target_;
};
template <typename TargetAsyncResult, typename = void>
@@ -509,22 +529,18 @@ struct cancellation_slot_binder_async_result_return_type<
template <typename T, typename CancellationSlot, typename Signature>
class async_result<cancellation_slot_binder<T, CancellationSlot>, Signature> :
- public detail::cancellation_slot_binder_async_result_completion_handler_type<
+ public detail::cancellation_slot_binder_completion_handler_async_result<
async_result<T, Signature>, CancellationSlot>,
public detail::cancellation_slot_binder_async_result_return_type<
async_result<T, Signature> >
{
public:
explicit async_result(cancellation_slot_binder<T, CancellationSlot>& b)
- : target_(b.get())
+ : detail::cancellation_slot_binder_completion_handler_async_result<
+ async_result<T, Signature>, CancellationSlot>(b.get())
{
}
- typename async_result<T, Signature>::return_type get()
- {
- return target_.get();
- }
-
template <typename Initiation>
struct init_wrapper
{
diff --git a/contrib/restricted/boost/asio/include/boost/asio/bind_immediate_executor.hpp b/contrib/restricted/boost/asio/include/boost/asio/bind_immediate_executor.hpp
index f9ff922ca5..a798759ea1 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/bind_immediate_executor.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/bind_immediate_executor.hpp
@@ -472,22 +472,41 @@ bind_immediate_executor(const Executor& e, BOOST_ASIO_MOVE_ARG(T) t)
namespace detail {
-template <typename TargetAsyncResult,
- typename Executor, typename = void>
-struct immediate_executor_binder_async_result_completion_handler_type
+template <typename TargetAsyncResult, typename Executor, typename = void>
+class immediate_executor_binder_completion_handler_async_result
{
+public:
+ template <typename T>
+ explicit immediate_executor_binder_completion_handler_async_result(T&)
+ {
+ }
};
template <typename TargetAsyncResult, typename Executor>
-struct immediate_executor_binder_async_result_completion_handler_type<
+class immediate_executor_binder_completion_handler_async_result<
TargetAsyncResult, Executor,
typename void_type<
typename TargetAsyncResult::completion_handler_type
>::type>
{
+public:
typedef immediate_executor_binder<
typename TargetAsyncResult::completion_handler_type, Executor>
completion_handler_type;
+
+ explicit immediate_executor_binder_completion_handler_async_result(
+ typename TargetAsyncResult::completion_handler_type& handler)
+ : target_(handler)
+ {
+ }
+
+ typename TargetAsyncResult::return_type get()
+ {
+ return target_.get();
+ }
+
+private:
+ TargetAsyncResult target_;
};
template <typename TargetAsyncResult, typename = void>
@@ -509,22 +528,18 @@ struct immediate_executor_binder_async_result_return_type<
template <typename T, typename Executor, typename Signature>
class async_result<immediate_executor_binder<T, Executor>, Signature> :
- public detail::immediate_executor_binder_async_result_completion_handler_type<
+ public detail::immediate_executor_binder_completion_handler_async_result<
async_result<T, Signature>, Executor>,
public detail::immediate_executor_binder_async_result_return_type<
async_result<T, Signature> >
{
public:
explicit async_result(immediate_executor_binder<T, Executor>& b)
- : target_(b.get())
+ : detail::immediate_executor_binder_completion_handler_async_result<
+ async_result<T, Signature>, Executor>(b.get())
{
}
- typename async_result<T, Signature>::return_type get()
- {
- return target_.get();
- }
-
template <typename Initiation>
struct init_wrapper
{
diff --git a/contrib/restricted/boost/asio/include/boost/asio/compose.hpp b/contrib/restricted/boost/asio/include/boost/asio/compose.hpp
index 3a43fbeff9..5f659ba7c8 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/compose.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/compose.hpp
@@ -340,6 +340,13 @@ struct associator<Associator,
* @param io_objects_or_executors Zero or more I/O objects or I/O executors for
* which outstanding work must be maintained.
*
+ * @par Per-Operation Cancellation
+ * By default, terminal per-operation cancellation is enabled for
+ * composed operations that are implemented using @c async_compose. To
+ * disable cancellation for the composed operation, or to alter its
+ * supported cancellation types, call the @c self object's @c
+ * reset_cancellation_state function.
+ *
* @par Example:
*
* @code struct async_echo_implementation
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 850037e531..dd8f199f66 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/detail/config.hpp
@@ -1679,7 +1679,7 @@
# include <unistd.h>
#endif // defined(BOOST_ASIO_HAS_UNISTD_H)
-// Linux: epoll, eventfd and timerfd.
+// Linux: epoll, eventfd, timerfd and io_uring.
#if defined(__linux__)
# include <linux/version.h>
# if !defined(BOOST_ASIO_HAS_EPOLL)
@@ -1703,6 +1703,11 @@
# endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
# endif // defined(BOOST_ASIO_HAS_EPOLL)
# endif // !defined(BOOST_ASIO_HAS_TIMERFD)
+# if defined(BOOST_ASIO_HAS_IO_URING)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
+# error Linux kernel 5.10 or later is required to support io_uring
+# endif // LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
+# endif // defined(BOOST_ASIO_HAS_IO_URING)
#endif // defined(__linux__)
// Linux: io_uring is used instead of epoll.
@@ -2042,7 +2047,7 @@
# endif // !defined(BOOST_ASIO_DISABLE_HANDLER_HOOKS)
#endif // !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
-// Support for the __thread keyword extension.
+// Support for the __thread keyword extension, or equivalent.
#if !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
# if defined(__linux__)
# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
@@ -2064,6 +2069,22 @@
# define BOOST_ASIO_THREAD_KEYWORD __declspec(thread)
# endif // (_MSC_VER >= 1700)
# endif // defined(BOOST_ASIO_MSVC) && defined(BOOST_ASIO_WINDOWS_RUNTIME)
+# if defined(__APPLE__)
+# if defined(__clang__)
+# if defined(__apple_build_version__)
+# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
+# define BOOST_ASIO_THREAD_KEYWORD __thread
+# endif // defined(__apple_build_version__)
+# endif // defined(__clang__)
+# endif // defined(__APPLE__)
+# if !defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION)
+# if defined(BOOST_ASIO_HAS_BOOST_CONFIG)
+# if !defined(BOOST_NO_CXX11_THREAD_LOCAL)
+# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
+# define BOOST_ASIO_THREAD_KEYWORD thread_local
+# endif // !defined(BOOST_NO_CXX11_THREAD_LOCAL)
+# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG)
+# endif // !defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION)
#endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
#if !defined(BOOST_ASIO_THREAD_KEYWORD)
# define BOOST_ASIO_THREAD_KEYWORD __thread
diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/dev_poll_reactor.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/dev_poll_reactor.hpp
index 506b1ae65f..97a66f04d7 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/detail/dev_poll_reactor.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/detail/dev_poll_reactor.hpp
@@ -109,10 +109,9 @@ public:
{
start_op(op_type, descriptor, descriptor_data,
op, is_continuation, allow_speculative,
- &epoll_reactor::call_post_immediate_completion, this);
+ &dev_poll_reactor::call_post_immediate_completion, this);
}
-
// Cancel all operations associated with the given descriptor. The
// handlers associated with the descriptor will be invoked with the
// operation_aborted error.
diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/io_uring_service.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/io_uring_service.ipp
index 98a08a601e..f0f4c84d89 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/io_uring_service.ipp
+++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/io_uring_service.ipp
@@ -436,15 +436,16 @@ void io_uring_service::run(long usec, op_queue<operation>& ops)
? ::io_uring_peek_cqe(&ring_, &cqe)
: ::io_uring_wait_cqe(&ring_, &cqe);
- if (result == 0 && usec > 0)
+ if (local_ops > 0)
{
- if (::io_uring_cqe_get_data(cqe) != &ts)
+ if (result != 0 || ::io_uring_cqe_get_data(cqe) != &ts)
{
mutex::scoped_lock lock(mutex_);
if (::io_uring_sqe* sqe = get_sqe())
{
++local_ops;
::io_uring_prep_timeout_remove(sqe, reinterpret_cast<__u64>(&ts), 0);
+ ::io_uring_sqe_set_data(sqe, &ts);
submit_sqes();
}
}
@@ -452,37 +453,41 @@ void io_uring_service::run(long usec, op_queue<operation>& ops)
bool check_timers = false;
int count = 0;
- while (result == 0)
+ while (result == 0 || local_ops > 0)
{
- if (void* ptr = ::io_uring_cqe_get_data(cqe))
+ if (result == 0)
{
- if (ptr == this)
+ if (void* ptr = ::io_uring_cqe_get_data(cqe))
{
- // The io_uring service was interrupted.
- }
- else if (ptr == &timer_queues_)
- {
- check_timers = true;
- }
- else if (ptr == &timeout_)
- {
- check_timers = true;
- timeout_.tv_sec = 0;
- timeout_.tv_nsec = 0;
- }
- else if (ptr == &ts)
- {
- --local_ops;
- }
- else
- {
- io_queue* io_q = static_cast<io_queue*>(ptr);
- io_q->set_result(cqe->res);
- ops.push(io_q);
+ if (ptr == this)
+ {
+ // The io_uring service was interrupted.
+ }
+ else if (ptr == &timer_queues_)
+ {
+ check_timers = true;
+ }
+ else if (ptr == &timeout_)
+ {
+ check_timers = true;
+ timeout_.tv_sec = 0;
+ timeout_.tv_nsec = 0;
+ }
+ else if (ptr == &ts)
+ {
+ --local_ops;
+ }
+ else
+ {
+ io_queue* io_q = static_cast<io_queue*>(ptr);
+ io_q->set_result(cqe->res);
+ ops.push(io_q);
+ }
}
+ ::io_uring_cqe_seen(&ring_, cqe);
+ ++count;
}
- ::io_uring_cqe_seen(&ring_, cqe);
- result = (++count < complete_batch_size || local_ops > 0)
+ result = (count < complete_batch_size || local_ops > 0)
? ::io_uring_peek_cqe(&ring_, &cqe) : -EAGAIN;
}
diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/signal_set_service.ipp b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/signal_set_service.ipp
index 695b688ce6..5719f2a113 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/detail/impl/signal_set_service.ipp
+++ b/contrib/restricted/boost/asio/include/boost/asio/detail/impl/signal_set_service.ipp
@@ -387,6 +387,7 @@ boost::system::error_code signal_set_service::add(
if (state->flags_[signal_number] != signal_set_base::flags::dont_care)
{
ec = boost::asio::error::invalid_argument;
+ delete new_registration;
return ec;
}
struct sigaction sa;
@@ -398,6 +399,7 @@ boost::system::error_code signal_set_service::add(
{
ec = boost::system::error_code(errno,
boost::asio::error::get_system_category());
+ delete new_registration;
return ec;
}
state->flags_[signal_number] = f;
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 5aec12fc11..24de6ff414 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/detail/memory.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/detail/memory.hpp
@@ -46,10 +46,12 @@ namespace asio {
namespace detail {
#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
+using std::allocate_shared;
using std::make_shared;
using std::shared_ptr;
using std::weak_ptr;
#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
+using boost::allocate_shared;
using boost::make_shared;
using boost::shared_ptr;
using boost::weak_ptr;
diff --git a/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_service_base.hpp b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_service_base.hpp
index 6dc7648374..0c44448406 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_service_base.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/detail/reactive_socket_service_base.hpp
@@ -701,7 +701,7 @@ protected:
{
public:
reactor_op_cancellation(reactor* r,
- reactor::per_descriptor_data* p, int d, int o)
+ reactor::per_descriptor_data* p, socket_type d, int o)
: reactor_(r),
reactor_data_(p),
descriptor_(d),
@@ -724,7 +724,7 @@ protected:
private:
reactor* reactor_;
reactor::per_descriptor_data* reactor_data_;
- int descriptor_;
+ socket_type descriptor_;
int op_type_;
};
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 2514e4c5e6..c3293bd991 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
@@ -1824,6 +1824,11 @@ public:
>::value
>::type* = 0) const
{
+ if (!target_)
+ {
+ bad_executor ex;
+ boost::asio::detail::throw_exception(ex);
+ }
typedef find_convertible_property<Property> found;
prop_fns_[found::index].query(0, object_fns_->target(*this),
&static_cast<const typename found::type&>(p));
@@ -1843,6 +1848,11 @@ public:
>::value
>::type* = 0) const
{
+ if (!target_)
+ {
+ bad_executor ex;
+ boost::asio::detail::throw_exception(ex);
+ }
typedef find_convertible_property<Property> found;
typename remove_reference<
typename found::query_result_type>::type* result = 0;
@@ -1865,6 +1875,11 @@ public:
>::value
>::type* = 0) const
{
+ if (!target_)
+ {
+ bad_executor ex;
+ boost::asio::detail::throw_exception(ex);
+ }
typedef find_convertible_property<Property> found;
typename found::query_result_type result;
prop_fns_[found::index].query(&result, object_fns_->target(*this),
@@ -1890,6 +1905,11 @@ public:
>::value
>::type* = 0) const
{
+ if (!target_)
+ {
+ bad_executor ex;
+ boost::asio::detail::throw_exception(ex);
+ }
typedef find_convertible_property<Property> found;
typename found::query_result_type* result;
prop_fns_[found::index].query(&result, object_fns_->target(*this),
@@ -1910,6 +1930,11 @@ public:
find_convertible_requirable_property<Property>::value
>::type* = 0) const
{
+ if (!target_)
+ {
+ bad_executor ex;
+ boost::asio::detail::throw_exception(ex);
+ }
typedef find_convertible_requirable_property<Property> found;
return prop_fns_[found::index].require(object_fns_->target(*this),
&static_cast<const typename found::type&>(p));
@@ -1927,6 +1952,11 @@ public:
find_convertible_preferable_property<Property>::value
>::type* = 0) const
{
+ if (!target_)
+ {
+ bad_executor ex;
+ boost::asio::detail::throw_exception(ex);
+ }
typedef find_convertible_preferable_property<Property> found;
return prop_fns_[found::index].prefer(object_fns_->target(*this),
&static_cast<const typename found::type&>(p));
@@ -2307,6 +2337,11 @@ inline void swap(any_executor<SupportableProperties...>& a,
>::value \
>::type* = 0) const \
{ \
+ if (!target_) \
+ { \
+ bad_executor ex; \
+ boost::asio::detail::throw_exception(ex); \
+ } \
typedef find_convertible_property<Property> found; \
prop_fns_[found::index].query(0, object_fns_->target(*this), \
&static_cast<const typename found::type&>(p)); \
@@ -2326,6 +2361,11 @@ inline void swap(any_executor<SupportableProperties...>& a,
>::value \
>::type* = 0) const \
{ \
+ if (!target_) \
+ { \
+ bad_executor ex; \
+ boost::asio::detail::throw_exception(ex); \
+ } \
typedef find_convertible_property<Property> found; \
typename remove_reference< \
typename found::query_result_type>::type* result; \
@@ -2348,6 +2388,11 @@ inline void swap(any_executor<SupportableProperties...>& a,
>::value \
>::type* = 0) const \
{ \
+ if (!target_) \
+ { \
+ bad_executor ex; \
+ boost::asio::detail::throw_exception(ex); \
+ } \
typedef find_convertible_property<Property> found; \
typename found::query_result_type result; \
prop_fns_[found::index].query(&result, object_fns_->target(*this), \
@@ -2373,6 +2418,11 @@ inline void swap(any_executor<SupportableProperties...>& a,
>::value \
>::type* = 0) const \
{ \
+ if (!target_) \
+ { \
+ bad_executor ex; \
+ boost::asio::detail::throw_exception(ex); \
+ } \
typedef find_convertible_property<Property> found; \
typename found::query_result_type* result; \
prop_fns_[found::index].query(&result, object_fns_->target(*this), \
@@ -2393,6 +2443,11 @@ inline void swap(any_executor<SupportableProperties...>& a,
find_convertible_requirable_property<Property>::value \
>::type* = 0) const \
{ \
+ if (!target_) \
+ { \
+ bad_executor ex; \
+ boost::asio::detail::throw_exception(ex); \
+ } \
typedef find_convertible_requirable_property<Property> found; \
return prop_fns_[found::index].require(object_fns_->target(*this), \
&static_cast<const typename found::type&>(p)); \
@@ -2410,6 +2465,11 @@ inline void swap(any_executor<SupportableProperties...>& a,
find_convertible_preferable_property<Property>::value \
>::type* = 0) const \
{ \
+ if (!target_) \
+ { \
+ bad_executor ex; \
+ boost::asio::detail::throw_exception(ex); \
+ } \
typedef find_convertible_preferable_property<Property> found; \
return prop_fns_[found::index].prefer(object_fns_->target(*this), \
&static_cast<const typename found::type&>(p)); \
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 0ae7c337b4..770c1fbd91 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
@@ -243,7 +243,7 @@ public:
: service_(other.service_),
executor_(other.executor_)
{
- service_->move_construct(impl_, *other.service_, other.impl_);
+ service_->move_construct(impl_, other.impl_);
}
/// Move-assign a basic_channel from another.
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 781fdbabf1..521c96d1c4 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
@@ -249,7 +249,7 @@ public:
: service_(other.service_),
executor_(other.executor_)
{
- service_->move_construct(impl_, *other.service_, other.impl_);
+ service_->move_construct(impl_, other.impl_);
}
/// Move-assign a basic_concurrent_channel from another.
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
index 6c20008eea..9e100b70cf 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/experimental/co_composed.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/experimental/co_composed.hpp
@@ -43,8 +43,9 @@ namespace experimental {
* 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
+ * By default, terminal per-operation cancellation is enabled for composed
+ * operations that use experimental::co_composed. To disable cancellation for
+ * the composed operation, or to alter its supported cancellation types, call
* the state's @c reset_cancellation_state function.
*
* @par Examples
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 ec7d956e1b..8042af5c8b 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
@@ -1070,17 +1070,17 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::true_type /* error is noexcept */,
std::true_type /* result is void */) //noexcept
{
- return [this, coro = coro_,
+ return [this, the_coro = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- assert(coro);
+ assert(the_coro);
- auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro);
+ auto ch = detail::coroutine_handle<promise_type>::from_promise(*the_coro);
assert(ch && !ch.done());
- coro->awaited_from = post_coroutine(std::move(exec), std::move(h));
- coro->reset_error();
+ the_coro->awaited_from = post_coroutine(std::move(exec), std::move(h));
+ the_coro->reset_error();
ch.resume();
};
}
@@ -1091,18 +1091,18 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::true_type /* error is noexcept */,
std::false_type /* result is void */) //noexcept
{
- return [coro = coro_,
+ return [the_coro = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- assert(coro);
+ assert(the_coro);
- auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro);
+ auto ch = detail::coroutine_handle<promise_type>::from_promise(*the_coro);
assert(ch && !ch.done());
- coro->awaited_from = detail::post_coroutine(
- exec, std::move(h), coro->result_).handle;
- coro->reset_error();
+ the_coro->awaited_from = detail::post_coroutine(
+ exec, std::move(h), the_coro->result_).handle;
+ the_coro->reset_error();
ch.resume();
};
}
@@ -1112,16 +1112,16 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::false_type /* error is noexcept */,
std::true_type /* result is void */)
{
- return [coro = coro_,
+ return [the_coro = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- if (!coro)
+ if (!the_coro)
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);
+ auto ch = detail::coroutine_handle<promise_type>::from_promise(*the_coro);
if (!ch)
return boost::asio::post(exec,
boost::asio::append(std::move(h),
@@ -1132,9 +1132,9 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
detail::coro_error<error_type>::done()));
else
{
- coro->awaited_from = detail::post_coroutine(
- exec, std::move(h), coro->error_).handle;
- coro->reset_error();
+ the_coro->awaited_from = detail::post_coroutine(
+ exec, std::move(h), the_coro->error_).handle;
+ the_coro->reset_error();
ch.resume();
}
};
@@ -1145,17 +1145,17 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::false_type /* error is noexcept */,
std::false_type /* result is void */)
{
- return [coro = coro_,
+ return [the_coro = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- if (!coro)
+ if (!the_coro)
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);
+ detail::coroutine_handle<promise_type>::from_promise(*the_coro);
if (!ch)
return boost::asio::post(exec,
boost::asio::append(std::move(h),
@@ -1166,9 +1166,9 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
detail::coro_error<error_type>::done(), result_type{}));
else
{
- coro->awaited_from = detail::post_coroutine(
- exec, std::move(h), coro->error_, coro->result_).handle;
- coro->reset_error();
+ the_coro->awaited_from = detail::post_coroutine(
+ exec, std::move(h), the_coro->error_, the_coro->result_).handle;
+ the_coro->reset_error();
ch.resume();
}
};
@@ -1204,9 +1204,9 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
[h = handle(exec, std::forward<WaitHandler>(handler),
std::integral_constant<bool, is_noexcept>{},
std::is_void<result_type>{}),
- in = std::forward<Input>(input), coro = coro_]() mutable
+ in = std::forward<Input>(input), the_coro = coro_]() mutable
{
- coro->input_ = std::move(in);
+ the_coro->input_ = std::move(in);
std::move(h)();
});
}
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 2cd73706e5..e7c0c92e4e 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
@@ -200,19 +200,26 @@ struct async_result<as_tuple_t<CompletionToken>, Signatures...>
};
template <typename Initiation, typename RawCompletionToken, typename... Args>
- static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(CompletionToken,
- typename detail::as_tuple_signature<Signatures>::type...,
- (async_initiate<CompletionToken,
- typename detail::as_tuple_signature<Signatures>::type...>(
- declval<init_wrapper<typename decay<Initiation>::type> >(),
- declval<CompletionToken&>(),
- declval<BOOST_ASIO_MOVE_ARG(Args)>()...)))
+ static BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(CompletionToken,
+ typename detail::as_tuple_signature<Signatures>::type...)
initiate(
BOOST_ASIO_MOVE_ARG(Initiation) initiation,
BOOST_ASIO_MOVE_ARG(RawCompletionToken) token,
BOOST_ASIO_MOVE_ARG(Args)... args)
+ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
+ async_initiate<
+ typename conditional<
+ is_const<typename remove_reference<RawCompletionToken>::type>::value,
+ const CompletionToken, CompletionToken>::type,
+ typename detail::as_tuple_signature<Signatures>::type...>(
+ init_wrapper<typename decay<Initiation>::type>(
+ BOOST_ASIO_MOVE_CAST(Initiation)(initiation)),
+ token.token_, BOOST_ASIO_MOVE_CAST(Args)(args)...)))
{
- return async_initiate<CompletionToken,
+ return async_initiate<
+ typename conditional<
+ is_const<typename remove_reference<RawCompletionToken>::type>::value,
+ const CompletionToken, CompletionToken>::type,
typename detail::as_tuple_signature<Signatures>::type...>(
init_wrapper<typename decay<Initiation>::type>(
BOOST_ASIO_MOVE_CAST(Initiation)(initiation)),
@@ -253,19 +260,26 @@ struct async_result<as_tuple_t<CompletionToken>, Signature>
};
template <typename Initiation, typename RawCompletionToken, typename... Args>
- static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(CompletionToken,
- typename detail::as_tuple_signature<Signature>::type,
- (async_initiate<CompletionToken,
- typename detail::as_tuple_signature<Signature>::type>(
- declval<init_wrapper<typename decay<Initiation>::type> >(),
- declval<CompletionToken&>(),
- declval<BOOST_ASIO_MOVE_ARG(Args)>()...)))
+ static BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(CompletionToken,
+ typename detail::as_tuple_signature<Signatures>::type...)
initiate(
BOOST_ASIO_MOVE_ARG(Initiation) initiation,
BOOST_ASIO_MOVE_ARG(RawCompletionToken) token,
BOOST_ASIO_MOVE_ARG(Args)... args)
+ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
+ async_initiate<
+ typename conditional<
+ is_const<typename remove_reference<RawCompletionToken>::type>::value,
+ const CompletionToken, CompletionToken>::type,
+ typename detail::as_tuple_signature<Signature>::type>(
+ init_wrapper<typename decay<Initiation>::type>(
+ BOOST_ASIO_MOVE_CAST(Initiation)(initiation)),
+ token.token_, BOOST_ASIO_MOVE_CAST(Args)(args)...)))
{
- return async_initiate<CompletionToken,
+ return async_initiate<
+ typename conditional<
+ is_const<typename remove_reference<RawCompletionToken>::type>::value,
+ const CompletionToken, CompletionToken>::type,
typename detail::as_tuple_signature<Signature>::type>(
init_wrapper<typename decay<Initiation>::type>(
BOOST_ASIO_MOVE_CAST(Initiation)(initiation)),
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 c6d75ea91a..974d5ffeba 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
@@ -18,6 +18,8 @@
#include <boost/asio/detail/config.hpp>
#include <boost/asio/associated_cancellation_slot.hpp>
#include <boost/asio/awaitable.hpp>
+#include <boost/asio/detail/memory.hpp>
+#include <boost/asio/detail/recycling_allocator.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/execution/outstanding_work.hpp>
#include <boost/asio/post.hpp>
@@ -70,43 +72,90 @@ struct co_spawn_work_guard<Executor,
#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS)
-template <typename Executor>
-inline co_spawn_work_guard<Executor>
-make_co_spawn_work_guard(const Executor& ex)
+template <typename Handler, typename Executor,
+ typename Function, typename = void>
+struct co_spawn_state
{
- return co_spawn_work_guard<Executor>(ex);
-}
+ template <typename H, typename F>
+ co_spawn_state(H&& h, const Executor& ex, F&& f)
+ : handler(std::forward<H>(h)),
+ spawn_work(ex),
+ handler_work(boost::asio::get_associated_executor(handler, ex)),
+ function(std::forward<F>(f))
+ {
+ }
-template <typename T, typename Executor, typename F, typename Handler>
-awaitable<awaitable_thread_entry_point, Executor> co_spawn_entry_point(
- awaitable<T, Executor>*, Executor ex, F f, Handler handler)
+ Handler handler;
+ co_spawn_work_guard<Executor> spawn_work;
+ co_spawn_work_guard<typename associated_executor<
+ Handler, Executor>::type> handler_work;
+ Function function;
+};
+
+template <typename Handler, typename Executor, typename Function>
+struct co_spawn_state<Handler, Executor, Function,
+ typename enable_if<
+ is_same<
+ typename associated_executor<Handler,
+ Executor>::asio_associated_executor_is_unspecialised,
+ void
+ >::value
+ >::type>
+{
+ template <typename H, typename F>
+ co_spawn_state(H&& h, const Executor& ex, F&& f)
+ : handler(std::forward<H>(h)),
+ handler_work(ex),
+ function(std::forward<F>(f))
+ {
+ }
+
+ Handler handler;
+ co_spawn_work_guard<Executor> handler_work;
+ Function function;
+};
+
+struct co_spawn_dispatch
{
- auto spawn_work = make_co_spawn_work_guard(ex);
- auto handler_work = make_co_spawn_work_guard(
- boost::asio::get_associated_executor(handler, ex));
+ template <typename CompletionToken>
+ auto operator()(CompletionToken&& token) const
+ -> decltype(boost::asio::dispatch(std::forward<CompletionToken>(token)))
+ {
+ return boost::asio::dispatch(std::forward<CompletionToken>(token));
+ }
+};
+
+struct co_spawn_post
+{
+ template <typename CompletionToken>
+ auto operator()(CompletionToken&& token) const
+ -> decltype(boost::asio::post(std::forward<CompletionToken>(token)))
+ {
+ return boost::asio::post(std::forward<CompletionToken>(token));
+ }
+};
- (void) co_await (dispatch)(
- use_awaitable_t<Executor>{__FILE__, __LINE__, "co_spawn_entry_point"});
+template <typename T, typename Handler, typename Executor, typename Function>
+awaitable<awaitable_thread_entry_point, Executor> co_spawn_entry_point(
+ awaitable<T, Executor>*, co_spawn_state<Handler, Executor, Function> s)
+{
+ (void) co_await co_spawn_dispatch{};
(co_await awaitable_thread_has_context_switched{}) = false;
std::exception_ptr e = nullptr;
bool done = false;
try
{
- T t = co_await f();
+ T t = co_await s.function();
done = true;
bool switched = (co_await awaitable_thread_has_context_switched{});
if (!switched)
- {
- (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
+ (void) co_await co_spawn_post();
+
+ (dispatch)(s.handler_work.get_executor(),
+ [handler = std::move(s.handler), t = std::move(t)]() mutable
{
std::move(handler)(std::exception_ptr(), std::move(t));
});
@@ -123,34 +172,26 @@ awaitable<awaitable_thread_entry_point, Executor> co_spawn_entry_point(
bool switched = (co_await awaitable_thread_has_context_switched{});
if (!switched)
- {
- (void) co_await (post)(
- use_awaitable_t<Executor>{__FILE__, __LINE__, "co_spawn_entry_point"});
- }
+ (void) co_await co_spawn_post();
- (dispatch)(handler_work.get_executor(),
- [handler = std::move(handler), e]() mutable
+ (dispatch)(s.handler_work.get_executor(),
+ [handler = std::move(s.handler), e]() mutable
{
std::move(handler)(e, T());
});
}
-template <typename Executor, typename F, typename Handler>
+template <typename Handler, typename Executor, typename Function>
awaitable<awaitable_thread_entry_point, Executor> co_spawn_entry_point(
- awaitable<void, Executor>*, Executor ex, F f, Handler handler)
+ awaitable<void, Executor>*, co_spawn_state<Handler, Executor, Function> s)
{
- auto spawn_work = make_co_spawn_work_guard(ex);
- auto handler_work = make_co_spawn_work_guard(
- boost::asio::get_associated_executor(handler, ex));
-
- (void) co_await (dispatch)(
- use_awaitable_t<Executor>{__FILE__, __LINE__, "co_spawn_entry_point"});
+ (void) co_await co_spawn_dispatch{};
(co_await awaitable_thread_has_context_switched{}) = false;
std::exception_ptr e = nullptr;
try
{
- co_await f();
+ co_await s.function();
}
catch (...)
{
@@ -159,13 +200,10 @@ awaitable<awaitable_thread_entry_point, Executor> co_spawn_entry_point(
bool switched = (co_await awaitable_thread_has_context_switched{});
if (!switched)
- {
- (void) co_await (post)(
- use_awaitable_t<Executor>{__FILE__, __LINE__, "co_spawn_entry_point"});
- }
+ (void) co_await co_spawn_post();
- (dispatch)(handler_work.get_executor(),
- [handler = std::move(handler), e]() mutable
+ (dispatch)(s.handler_work.get_executor(),
+ [handler = std::move(s.handler), e]() mutable
{
std::move(handler)(e);
});
@@ -194,27 +232,29 @@ class co_spawn_cancellation_handler
{
public:
co_spawn_cancellation_handler(const Handler&, const Executor& ex)
- : ex_(ex)
+ : signal_(detail::allocate_shared<cancellation_signal>(
+ detail::recycling_allocator<cancellation_signal,
+ detail::thread_info_base::cancellation_signal_tag>())),
+ ex_(ex)
{
}
cancellation_slot slot()
{
- return signal_.slot();
+ return signal_->slot();
}
void operator()(cancellation_type_t type)
{
- cancellation_signal* sig = &signal_;
+ shared_ptr<cancellation_signal> sig = signal_;
boost::asio::dispatch(ex_, [sig, type]{ sig->emit(type); });
}
private:
- cancellation_signal signal_;
+ shared_ptr<cancellation_signal> signal_;
Executor ex_;
};
-
template <typename Handler, typename Executor>
class co_spawn_cancellation_handler<Handler, Executor,
typename enable_if<
@@ -266,6 +306,7 @@ public:
{
typedef typename result_of<F()>::type awaitable_type;
typedef typename decay<Handler>::type handler_type;
+ typedef typename decay<F>::type function_type;
typedef co_spawn_cancellation_handler<
handler_type, Executor> cancel_handler_type;
@@ -282,7 +323,8 @@ public:
cancellation_state cancel_state(proxy_slot);
auto a = (co_spawn_entry_point)(static_cast<awaitable_type*>(nullptr),
- ex_, std::forward<F>(f), std::forward<Handler>(handler));
+ co_spawn_state<handler_type, Executor, function_type>(
+ std::forward<Handler>(handler), ex_, std::forward<F>(f)));
awaitable_handler<executor_type, void>(std::move(a),
ex_, proxy_slot, cancel_state).launch();
}
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 1d9d79115a..2c054cd889 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/impl/spawn.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/impl/spawn.hpp
@@ -670,7 +670,7 @@ public:
struct result_type
{
- exception_ptr ex_;
+ exception_ptr* ex_;
return_type* value_;
};
@@ -788,7 +788,7 @@ public:
struct result_type
{
- exception_ptr ex_;
+ exception_ptr* ex_;
return_type* value_;
};
diff --git a/contrib/restricted/boost/asio/include/boost/asio/ip/bad_address_cast.hpp b/contrib/restricted/boost/asio/include/boost/asio/ip/bad_address_cast.hpp
index 28a1786bdf..bd6c39f993 100644
--- a/contrib/restricted/boost/asio/include/boost/asio/ip/bad_address_cast.hpp
+++ b/contrib/restricted/boost/asio/include/boost/asio/ip/bad_address_cast.hpp
@@ -36,6 +36,16 @@ public:
/// Default constructor.
bad_address_cast() {}
+ /// Copy constructor.
+ bad_address_cast(const bad_address_cast& other) BOOST_ASIO_NOEXCEPT_OR_NOTHROW
+#if defined(BOOST_ASIO_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS
+ : std::exception(static_cast<const std::exception&>(other))
+#else
+ : std::bad_cast(static_cast<const std::bad_cast&>(other))
+#endif
+ {
+ }
+
/// Destructor.
virtual ~bad_address_cast() BOOST_ASIO_NOEXCEPT_OR_NOTHROW {}
diff --git a/contrib/restricted/boost/asio/include/boost/asio/version.hpp b/contrib/restricted/boost/asio/include/boost/asio/version.hpp
index 53e4fd4003..b548149097 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 102800 // 1.28.0
+#define BOOST_ASIO_VERSION 102802 // 1.28.2
#endif // BOOST_ASIO_VERSION_HPP
diff --git a/contrib/restricted/boost/asio/ya.make b/contrib/restricted/boost/asio/ya.make
index 0a481235b0..16062f989a 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.82.0)
+VERSION(1.83.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/asio/archive/boost-1.82.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/asio/archive/boost-1.83.0.tar.gz)
PEERDIR(
contrib/libs/openssl