From 7c30f36554d191d4e686c6bebcfe19ee09862694 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 9 Feb 2023 18:58:21 -0500 Subject: [PATCH] common/async: SharedMutex uses free function post Signed-off-by: Casey Bodley --- src/common/async/detail/shared_mutex.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/common/async/detail/shared_mutex.h b/src/common/async/detail/shared_mutex.h index 8e5436350cf..5bfd0d58b1c 100644 --- a/src/common/async/detail/shared_mutex.h +++ b/src/common/async/detail/shared_mutex.h @@ -135,10 +135,9 @@ auto SharedMutexImpl::async_lock(Mutex& mtx, CompletionToken&& token) // post a successful completion auto ex2 = boost::asio::get_associated_executor(handler, ex1); - auto alloc2 = boost::asio::get_associated_allocator(handler); - auto b = bind_handler(std::move(handler), ec, - std::unique_lock{mtx, std::adopt_lock}); - ex2.post(forward_handler(std::move(b)), alloc2); + auto h = boost::asio::bind_executor(ex2, std::move(handler)); + boost::asio::post(bind_handler(std::move(h), ec, + std::unique_lock{mtx, std::adopt_lock})); } else { // create a request and add it to the exclusive list using LockCompletion = typename Request::LockCompletion; @@ -227,10 +226,9 @@ auto SharedMutexImpl::async_lock_shared(Mutex& mtx, CompletionToken&& token) state++; auto ex2 = boost::asio::get_associated_executor(handler, ex1); - auto alloc2 = boost::asio::get_associated_allocator(handler); - auto b = bind_handler(std::move(handler), ec, - std::shared_lock{mtx, std::adopt_lock}); - ex2.post(forward_handler(std::move(b)), alloc2); + auto h = boost::asio::bind_executor(ex2, std::move(handler)); + boost::asio::post(bind_handler(std::move(h), ec, + std::shared_lock{mtx, std::adopt_lock})); } else { using LockCompletion = typename Request::LockCompletion; auto request = LockCompletion::create(ex1, std::move(handler), mtx); -- 2.47.3