diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:22:41 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:22:41 +0900 |
commit | 3c1df2168531ad5580076ae08d529054689aeedd (patch) | |
tree | 941aff6f86393eecacddfec252a8508c7e8351c9 /boost/asio/strand.hpp | |
parent | d6a306e745acfee00e81ccaf3324a2a03516db41 (diff) | |
download | boost-3c1df2168531ad5580076ae08d529054689aeedd.tar.gz boost-3c1df2168531ad5580076ae08d529054689aeedd.tar.bz2 boost-3c1df2168531ad5580076ae08d529054689aeedd.zip |
Imported Upstream version 1.70.0upstream/1.70.0
Diffstat (limited to 'boost/asio/strand.hpp')
-rw-r--r-- | boost/asio/strand.hpp | 29 |
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 |