]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/asio/example/cpp14/operations/composed_6.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / asio / example / cpp14 / operations / composed_6.cpp
index 8b6d011909c75fc24c68010fdf639128edd22cfc..cdfb71a8248f11d7ea1ce232c01859c05486c63e 100644 (file)
@@ -108,7 +108,9 @@ auto async_write_messages(tcp::socket& socket,
       // As our composed operation performs multiple underlying I/O operations,
       // we should maintain a work object against the I/O executor. This tells
       // the I/O executor that there is still more work to come in the future.
-      boost::asio::executor_work_guard<tcp::socket::executor_type> io_work_;
+      typename std::decay<decltype(boost::asio::prefer(
+            std::declval<tcp::socket::executor_type>(),
+            boost::asio::execution::outstanding_work.tracked))>::type io_work_;
 
       // The user-supplied completion handler, called once only on completion
       // of the entire composed operation.
@@ -145,9 +147,6 @@ auto async_write_messages(tcp::socket& socket,
         // This point is reached only on completion of the entire composed
         // operation.
 
-        // We no longer have any future work coming for the I/O executor.
-        io_work_.reset();
-
         // Deallocate the encoded message before calling the user-supplied
         // completion handler.
         encoded_message_.reset();
@@ -198,7 +197,8 @@ auto async_write_messages(tcp::socket& socket,
           socket, std::move(encoded_message),
           repeat_count, std::move(delay_timer),
           intermediate_completion_handler::starting,
-          boost::asio::make_work_guard(socket.get_executor()),
+          boost::asio::prefer(socket.get_executor(),
+              boost::asio::execution::outstanding_work.tracked),
           std::forward<decltype(completion_handler)>(completion_handler)});
   };