]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/awaitable.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / asio / awaitable.hpp
index 6bf145696043a0e322a8b7a7539b96d5d0a5f17b..6564cfd59dd2d96e690f6d1ff4d637d468b56492 100644 (file)
 
 #if defined(BOOST_ASIO_HAS_CO_AWAIT) || defined(GENERATING_DOCUMENTATION)
 
-#include <experimental/coroutine>
-#include <boost/asio/executor.hpp>
+#if defined(BOOST_ASIO_HAS_STD_COROUTINE)
+# include <coroutine>
+#else // defined(BOOST_ASIO_HAS_STD_COROUTINE)
+# include <experimental/coroutine>
+#endif // defined(BOOST_ASIO_HAS_STD_COROUTINE)
+
+#include <boost/asio/any_io_executor.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -28,8 +33,13 @@ namespace boost {
 namespace asio {
 namespace detail {
 
+#if defined(BOOST_ASIO_HAS_STD_COROUTINE)
+using std::coroutine_handle;
+using std::suspend_always;
+#else // defined(BOOST_ASIO_HAS_STD_COROUTINE)
 using std::experimental::coroutine_handle;
 using std::experimental::suspend_always;
+#endif // defined(BOOST_ASIO_HAS_STD_COROUTINE)
 
 template <typename> class awaitable_thread;
 template <typename, typename> class awaitable_frame;
@@ -37,7 +47,7 @@ template <typename, typename> class awaitable_frame;
 } // namespace detail
 
 /// The return type of a coroutine or asynchronous operation.
-template <typename T, typename Executor = executor>
+template <typename T, typename Executor = any_io_executor>
 class awaitable
 {
 public:
@@ -91,7 +101,7 @@ public:
   // Support for co_await keyword.
   T await_resume()
   {
-    return frame_->get();
+    return awaitable(static_cast<awaitable&&>(*this)).frame_->get();
   }
 
 #endif // !defined(GENERATING_DOCUMENTATION)