]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/async: SharedMutex uses free function post
authorCasey Bodley <cbodley@redhat.com>
Thu, 9 Feb 2023 23:58:21 +0000 (18:58 -0500)
committerAdam Emerson <aemerson@redhat.com>
Wed, 6 Dec 2023 20:39:35 +0000 (15:39 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/common/async/detail/shared_mutex.h

index 8e5436350cfd63fda4a300f6c4ae92e06e0862a3..5bfd0d58b1cc3242bd123b99f430abdb094105b4 100644 (file)
@@ -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);