]> 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)
committerCasey Bodley <cbodley@redhat.com>
Mon, 13 May 2024 16:13:40 +0000 (12:13 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_pubsub_push.cc

index 16937ef23ec26dbfec71ec655bbf4c597f58323a..8906d2e6cb95685eab8790f634a87ddac45a1ec5 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);});