From: Casey Bodley Date: Mon, 14 Oct 2024 18:44:19 +0000 (-0400) Subject: common/async: use asio::associator for Forwarding/CompletionHandler X-Git-Tag: v20.0.0~574^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c6415e14eb274adcc54ca2a117ab06fc71cc6057;p=ceph.git common/async: use asio::associator for Forwarding/CompletionHandler asio keeps adding new types of associations. since this was written, get_associated_cancellation_slot() and get_associated_immediate_executor() were added. we can now specialize the asio::associator<> template to forward all of them Signed-off-by: Casey Bodley --- diff --git a/src/common/async/bind_handler.h b/src/common/async/bind_handler.h index 69128501a07f..4cc9a2a113d2 100644 --- a/src/common/async/bind_handler.h +++ b/src/common/async/bind_handler.h @@ -16,8 +16,7 @@ #define CEPH_ASYNC_BIND_HANDLER_H #include -#include -#include +#include namespace ceph::async { @@ -52,25 +51,25 @@ struct CompletionHandler { void operator()() && { std::apply(std::move(handler), std::move(args)); } - - using allocator_type = boost::asio::associated_allocator_t; - allocator_type get_allocator() const noexcept { - return boost::asio::get_associated_allocator(handler); - } }; } // namespace ceph::async namespace boost::asio { -// specialize boost::asio::associated_executor<> for CompletionHandler -template -struct associated_executor, Executor> { - using type = boost::asio::associated_executor_t; - - static type get(const ceph::async::CompletionHandler& handler, - const Executor& ex = Executor()) noexcept { - return boost::asio::get_associated_executor(handler.handler, ex); +// forward the handler's associated executor, allocator, cancellation slot, etc +template