summaryrefslogtreecommitdiff
path: root/boost/asio/strand.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/strand.hpp')
-rw-r--r--boost/asio/strand.hpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/boost/asio/strand.hpp b/boost/asio/strand.hpp
index b82e988fe4..d08801bd90 100644
--- a/boost/asio/strand.hpp
+++ b/boost/asio/strand.hpp
@@ -2,7 +2,7 @@
// strand.hpp
// ~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -272,6 +272,33 @@ private:
implementation_type impl_;
};
+/** @defgroup make_strand boost::asio::make_strand
+ *
+ * @brief The boost::asio::make_strand function creates a @ref strand object for
+ * an executor or execution context.
+ */
+/*@{*/
+
+/// Create a @ref strand object for an executor.
+template <typename Executor>
+inline strand<Executor> make_strand(const Executor& ex,
+ typename enable_if<is_executor<Executor>::value>::type* = 0)
+{
+ return strand<Executor>(ex);
+}
+
+/// Create a @ref strand object for an execution context.
+template <typename ExecutionContext>
+inline strand<typename ExecutionContext::executor_type>
+make_strand(ExecutionContext& ctx,
+ typename enable_if<
+ is_convertible<ExecutionContext&, execution_context&>::value>::type* = 0)
+{
+ return strand<typename ExecutionContext::executor_type>(ctx.get_executor());
+}
+
+/*@}*/
+
} // namespace asio
} // namespace boost