Rename executor_work to executor_work_guard.
diff --git a/asio/include/Makefile.am b/asio/include/Makefile.am index cdd5114..15aa7e8 100644 --- a/asio/include/Makefile.am +++ b/asio/include/Makefile.am
@@ -274,7 +274,7 @@ asio/error_code.hpp \ asio/error.hpp \ asio/execution_context.hpp \ - asio/executor_work.hpp \ + asio/executor_work_guard.hpp \ asio/executor.hpp \ asio/generic/basic_endpoint.hpp \ asio/generic/datagram_protocol.hpp \
diff --git a/asio/include/asio.hpp b/asio/include/asio.hpp index 06febc6..576fdc7 100644 --- a/asio/include/asio.hpp +++ b/asio/include/asio.hpp
@@ -52,7 +52,7 @@ #include "asio/error_code.hpp" #include "asio/execution_context.hpp" #include "asio/executor.hpp" -#include "asio/executor_work.hpp" +#include "asio/executor_work_guard.hpp" #include "asio/generic/basic_endpoint.hpp" #include "asio/generic/datagram_protocol.hpp" #include "asio/generic/raw_protocol.hpp"
diff --git a/asio/include/asio/detail/impl/strand_executor_service.hpp b/asio/include/asio/detail/impl/strand_executor_service.hpp index cb0256a..94d6e41 100644 --- a/asio/include/asio/detail/impl/strand_executor_service.hpp +++ b/asio/include/asio/detail/impl/strand_executor_service.hpp
@@ -19,7 +19,7 @@ #include "asio/detail/fenced_block.hpp" #include "asio/detail/handler_invoke_helpers.hpp" #include "asio/detail/recycling_allocator.hpp" -#include "asio/executor_work.hpp" +#include "asio/executor_work_guard.hpp" #include "asio/detail/push_options.hpp" @@ -45,7 +45,7 @@ #if defined(ASIO_HAS_MOVE) invoker(invoker&& other) : impl_(ASIO_MOVE_CAST(implementation_type)(other.impl_)), - work_(ASIO_MOVE_CAST(executor_work<Executor>)(other.work_)) + work_(ASIO_MOVE_CAST(executor_work_guard<Executor>)(other.work_)) { } #endif // defined(ASIO_HAS_MOVE) @@ -92,7 +92,7 @@ private: implementation_type impl_; - executor_work<Executor> work_; + executor_work_guard<Executor> work_; }; template <typename Executor, typename Function, typename Allocator>
diff --git a/asio/include/asio/detail/work_dispatcher.hpp b/asio/include/asio/detail/work_dispatcher.hpp index ab5ef18..cac2e8a 100644 --- a/asio/include/asio/detail/work_dispatcher.hpp +++ b/asio/include/asio/detail/work_dispatcher.hpp
@@ -18,7 +18,7 @@ #include "asio/detail/config.hpp" #include "asio/associated_executor.hpp" #include "asio/associated_allocator.hpp" -#include "asio/executor_work.hpp" +#include "asio/executor_work_guard.hpp" #include "asio/detail/push_options.hpp" @@ -43,7 +43,7 @@ } work_dispatcher(work_dispatcher&& other) - : work_(ASIO_MOVE_CAST(executor_work< + : work_(ASIO_MOVE_CAST(executor_work_guard< typename associated_executor<Handler>::type>)(other.work_)), handler_(ASIO_MOVE_CAST(Handler)(other.handler_)) { @@ -60,7 +60,7 @@ } private: - executor_work<typename associated_executor<Handler>::type> work_; + executor_work_guard<typename associated_executor<Handler>::type> work_; Handler handler_; };
diff --git a/asio/include/asio/executor_work.hpp b/asio/include/asio/executor_work_guard.hpp similarity index 64% rename from asio/include/asio/executor_work.hpp rename to asio/include/asio/executor_work_guard.hpp index bc20eb3..5774d21 100644 --- a/asio/include/asio/executor_work.hpp +++ b/asio/include/asio/executor_work_guard.hpp
@@ -1,5 +1,5 @@ // -// executor_work.hpp +// executor_work_guard.hpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) @@ -8,8 +8,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef ASIO_EXECUTOR_WORK_HPP -#define ASIO_EXECUTOR_WORK_HPP +#ifndef ASIO_EXECUTOR_WORK_GUARD_HPP +#define ASIO_EXECUTOR_WORK_GUARD_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once @@ -23,20 +23,20 @@ namespace asio { -/// An object of type @c executor_work controls ownership of executor work +/// An object of type @c executor_work_guard controls ownership of executor work /// within a scope. template <typename Executor> -class executor_work +class executor_work_guard { public: /// The underlying executor type. typedef Executor executor_type; - /// Constructs a @c executor_work object for the specified executor. + /// Constructs a @c executor_work_guard object for the specified executor. /** * Stores a copy of @c e and calls <tt>on_work_started()</tt> on it. */ - explicit executor_work(const executor_type& e) ASIO_NOEXCEPT + explicit executor_work_guard(const executor_type& e) ASIO_NOEXCEPT : executor_(e), owns_(true) { @@ -44,7 +44,7 @@ } /// Copy constructor. - executor_work(const executor_work& other) ASIO_NOEXCEPT + executor_work_guard(const executor_work_guard& other) ASIO_NOEXCEPT : executor_(other.executor_), owns_(other.owns_) { @@ -54,7 +54,7 @@ #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move constructor. - executor_work(executor_work&& other) + executor_work_guard(executor_work_guard&& other) : executor_(ASIO_MOVE_CAST(Executor)(other.executor_)), owns_(other.owns_) { @@ -67,7 +67,7 @@ * Unless the object has already been reset, or is in a moved-from state, * calls <tt>on_work_finished()</tt> on the stored executor. */ - ~executor_work() + ~executor_work_guard() { if (owns_) executor_.on_work_finished(); @@ -79,7 +79,7 @@ return executor_; } - /// Whether the executor_work object owns some outstanding work. + /// Whether the executor_work_guard object owns some outstanding work. bool owns_work() const ASIO_NOEXCEPT { return owns_; @@ -101,61 +101,61 @@ private: // Disallow assignment. - executor_work& operator=(const executor_work&); + executor_work_guard& operator=(const executor_work_guard&); executor_type executor_; bool owns_; }; -/// Create an @ref executor_work object. +/// Create an @ref executor_work_guard object. template <typename Executor> -inline executor_work<Executor> make_work(const Executor& ex, +inline executor_work_guard<Executor> make_work_guard(const Executor& ex, typename enable_if<is_executor<Executor>::value>::type* = 0) { - return executor_work<Executor>(ex); + return executor_work_guard<Executor>(ex); } -/// Create an @ref executor_work object. +/// Create an @ref executor_work_guard object. template <typename ExecutionContext> -inline executor_work<typename ExecutionContext::executor_type> -make_work(ExecutionContext& ctx, +inline executor_work_guard<typename ExecutionContext::executor_type> +make_work_guard(ExecutionContext& ctx, typename enable_if< is_convertible<ExecutionContext&, execution_context&>::value>::type* = 0) { - return executor_work<typename ExecutionContext::executor_type>( + return executor_work_guard<typename ExecutionContext::executor_type>( ctx.get_executor()); } -/// Create an @ref executor_work object. +/// Create an @ref executor_work_guard object. template <typename T> -inline executor_work<typename associated_executor<T>::type> -make_work(const T& t, +inline executor_work_guard<typename associated_executor<T>::type> +make_work_guard(const T& t, typename enable_if<!is_executor<T>::value && !is_convertible<T&, execution_context&>::value>::type* = 0) { - return executor_work<typename associated_executor<T>::type>( + return executor_work_guard<typename associated_executor<T>::type>( associated_executor<T>::get(t)); } -/// Create an @ref executor_work object. +/// Create an @ref executor_work_guard object. template <typename T, typename Executor> -inline executor_work<typename associated_executor<T, Executor>::type> -make_work(const T& t, const Executor& ex, +inline executor_work_guard<typename associated_executor<T, Executor>::type> +make_work_guard(const T& t, const Executor& ex, typename enable_if<is_executor<Executor>::value>::type* = 0) { - return executor_work<typename associated_executor<T, Executor>::type>( + return executor_work_guard<typename associated_executor<T, Executor>::type>( associated_executor<T, Executor>::get(t, ex)); } -/// Create an @ref executor_work object. +/// Create an @ref executor_work_guard object. template <typename T, typename ExecutionContext> -inline executor_work<typename associated_executor<T, +inline executor_work_guard<typename associated_executor<T, typename ExecutionContext::executor_type>::type> -make_work(const T& t, ExecutionContext& ctx, +make_work_guard(const T& t, ExecutionContext& ctx, typename enable_if<!is_executor<T>::value && !is_convertible<T&, execution_context&>::value>::type* = 0) { - return executor_work<typename associated_executor<T, + return executor_work_guard<typename associated_executor<T, typename ExecutionContext::executor_type>::type>( associated_executor<T, typename ExecutionContext::executor_type>::get( t, ctx.get_executor())); @@ -165,4 +165,4 @@ #include "asio/detail/pop_options.hpp" -#endif // ASIO_EXECUTOR_WORK_HPP +#endif // ASIO_EXECUTOR_WORK_GUARD_HPP
diff --git a/asio/include/asio/io_service.hpp b/asio/include/asio/io_service.hpp index fc6cc60..a487d0c 100644 --- a/asio/include/asio/io_service.hpp +++ b/asio/include/asio/io_service.hpp
@@ -616,8 +616,8 @@ #endif // !defined(GENERATING_DOCUMENTATION) -/// (Deprecated: Use executor_work.) Class to inform the io_service when it has -/// work to do. +/// (Deprecated: Use executor_work_guard.) Class to inform the io_service when +/// it has work to do. /** * The work class is used to inform the io_service when work starts and * finishes. This ensures that the io_service object's run() function will not
diff --git a/asio/include/asio/ts/executor.hpp b/asio/include/asio/ts/executor.hpp index 3f0759f..8ba3871 100644 --- a/asio/include/asio/ts/executor.hpp +++ b/asio/include/asio/ts/executor.hpp
@@ -22,7 +22,7 @@ #include "asio/is_executor.hpp" #include "asio/associated_executor.hpp" #include "asio/bind_executor.hpp" -#include "asio/executor_work.hpp" +#include "asio/executor_work_guard.hpp" #include "asio/system_executor.hpp" #include "asio/executor.hpp" #include "asio/dispatch.hpp"
diff --git a/asio/src/examples/cpp14/executors/async_1.cpp b/asio/src/examples/cpp14/executors/async_1.cpp index 2a78894..40046fd 100644 --- a/asio/src/examples/cpp14/executors/async_1.cpp +++ b/asio/src/examples/cpp14/executors/async_1.cpp
@@ -5,7 +5,7 @@ using asio::bind_executor; using asio::dispatch; -using asio::make_work; +using asio::make_work_guard; using asio::post; using asio::thread_pool; @@ -14,7 +14,7 @@ void async_getline(std::istream& is, Handler handler) { // Create executor_work for the handler's associated executor. - auto work = make_work(handler); + auto work = make_work_guard(handler); // Post a function object to do the work asynchronously. post([&is, work, handler=std::move(handler)]() mutable
diff --git a/asio/src/examples/cpp14/executors/async_2.cpp b/asio/src/examples/cpp14/executors/async_2.cpp index 4d7695f..396faae 100644 --- a/asio/src/examples/cpp14/executors/async_2.cpp +++ b/asio/src/examples/cpp14/executors/async_2.cpp
@@ -6,7 +6,7 @@ using asio::bind_executor; using asio::dispatch; using asio::get_associated_executor; -using asio::make_work; +using asio::make_work_guard; using asio::post; using asio::thread_pool; @@ -15,7 +15,7 @@ void async_getline(std::istream& is, Handler handler) { // Create executor_work for the handler's associated executor. - auto work = make_work(handler); + auto work = make_work_guard(handler); // Post a function object to do the work asynchronously. post([&is, work, handler=std::move(handler)]() mutable