]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/impl/spawn.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / impl / spawn.hpp
index f46a461d91d6cdcd64f7e27adabf4ffa81373091..43778cf898d938eaf7150848421ee0753982bf72 100644 (file)
@@ -2,7 +2,7 @@
 // impl/spawn.hpp
 // ~~~~~~~~~~~~~~
 //
-// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -296,28 +296,18 @@ public:
   }
 };
 
-template <typename Handler, typename T, typename Allocator>
-struct associated_allocator<detail::coro_handler<Handler, T>, Allocator>
+template <template <typename, typename> class Associator,
+    typename Handler, typename T, typename DefaultCandidate>
+struct associator<Associator,
+    detail::coro_handler<Handler, T>,
+    DefaultCandidate>
+  : Associator<Handler, DefaultCandidate>
 {
-  typedef typename associated_allocator<Handler, Allocator>::type type;
-
-  static type get(const detail::coro_handler<Handler, T>& h,
-      const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
-  {
-    return associated_allocator<Handler, Allocator>::get(h.handler_, a);
-  }
-};
-
-template <typename Handler, typename T, typename Executor>
-struct associated_executor<detail::coro_handler<Handler, T>, Executor>
-  : detail::associated_executor_forwarding_base<Handler, Executor>
-{
-  typedef typename associated_executor<Handler, Executor>::type type;
-
-  static type get(const detail::coro_handler<Handler, T>& h,
-      const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
+  static typename Associator<Handler, DefaultCandidate>::type get(
+      const detail::coro_handler<Handler, T>& h,
+      const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
   {
-    return associated_executor<Handler, Executor>::get(h.handler_, ex);
+    return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
   }
 };
 
@@ -355,7 +345,7 @@ namespace detail {
 
       (data->function_)(yield);
       if (data->call_handler_)
-        (data->handler_)();
+        BOOST_ASIO_MOVE_OR_LVALUE(Handler)(data->handler_)();
     }
 
     shared_ptr<spawn_data<Handler, Function> > data_;
@@ -435,10 +425,10 @@ template <typename Handler, typename Function>
 void spawn(BOOST_ASIO_MOVE_ARG(Handler) handler,
     BOOST_ASIO_MOVE_ARG(Function) function,
     const boost::coroutines::attributes& attributes,
-    typename enable_if<
+    typename constraint<
       !is_executor<typename decay<Handler>::type>::value &&
       !execution::is_executor<typename decay<Handler>::type>::value &&
-      !is_convertible<Handler&, execution_context&>::value>::type*)
+      !is_convertible<Handler&, execution_context&>::value>::type)
 {
   typedef typename decay<Handler>::type handler_type;
   typedef typename decay<Function>::type function_type;
@@ -476,9 +466,9 @@ template <typename Function, typename Executor>
 inline void spawn(const Executor& ex,
     BOOST_ASIO_MOVE_ARG(Function) function,
     const boost::coroutines::attributes& attributes,
-    typename enable_if<
+    typename constraint<
       is_executor<Executor>::value || execution::is_executor<Executor>::value
-    >::type*)
+    >::type)
 {
   boost::asio::spawn(boost::asio::strand<Executor>(ex),
       BOOST_ASIO_MOVE_CAST(Function)(function), attributes);
@@ -512,8 +502,8 @@ template <typename Function, typename ExecutionContext>
 inline void spawn(ExecutionContext& ctx,
     BOOST_ASIO_MOVE_ARG(Function) function,
     const boost::coroutines::attributes& attributes,
-    typename enable_if<is_convertible<
-      ExecutionContext&, execution_context&>::value>::type*)
+    typename constraint<is_convertible<
+      ExecutionContext&, execution_context&>::value>::type)
 {
   boost::asio::spawn(ctx.get_executor(),
       BOOST_ASIO_MOVE_CAST(Function)(function), attributes);