]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/pubsub: Waiter uses async_initiate
authorCasey Bodley <cbodley@redhat.com>
Thu, 15 Feb 2024 03:42:10 +0000 (22:42 -0500)
committerliangmingyuan <liangmingyuan@baidu.com>
Sat, 5 Oct 2024 03:06:15 +0000 (11:06 +0800)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 3618271b30b6b48de98c37cdc51de9b7475ed8a0)

src/rgw/driver/rados/rgw_pubsub_push.cc

index 1bf1a718efbec4a7945b3edd8d74fa4866437477..b73da6b42d491dbc1eeeffd040d992689252b955 100644 (file)
@@ -136,7 +136,6 @@ namespace {
 class Waiter {
   using Signature = void(boost::system::error_code);
   using Completion = ceph::async::Completion<Signature>;
-  using CompletionInit = boost::asio::async_completion<spawn::yield_context, Signature>;
   std::unique_ptr<Completion> completion = nullptr;
   int ret;
 
@@ -152,12 +151,13 @@ public:
     }
     if (y) {
       boost::system::error_code ec;
-      auto&& token = y.get_yield_context()[ec];
-      CompletionInit init(token);
-      completion = Completion::create(y.get_io_context().get_executor(),
-          std::move(init.completion_handler));
+      auto yield = y.get_yield_context();
+      auto&& token = yield[ec];
+      boost::asio::async_initiate<spawn::yield_context, Signature>(
+          [this] (auto handler, auto ex) {
+            completion = Completion::create(ex, std::move(handler));
+          }, token, yield.get_executor());
       l.unlock();
-      init.result.get();
       return -ec.value();
     }
     cond.wait(l, [this]{return (done==true);});