namespace std { namespace experimental { namespace net { inline namespace v1 { template<class Executor> class executor_work_guard { public: // types: using executor_type = Executor; // construct / copy / destroy: explicit executor_work_guard(const executor_type& ex) noexcept; executor_work_guard(const executor_work_guard& other) noexcept; executor_work_guard(executor_work_guard&& other) noexcept; executor_work_guard& operator=(const executor_work_guard&) = delete; ~executor_work_guard(); // executor work guard observers: executor_type get_executor() const noexcept; bool owns_work() const noexcept; // executor work guard modifiers: void reset() noexcept; private: Executor ex_; // exposition only bool owns_; // exposition only }; } // inline namespace v1 } // namespace net } // namespace experimental } // namespace std
explicit executor_work_guard(const executor_type& ex) noexcept;
Effects: Initializes ex_ with ex, and then performs ex_.on_work_started().
Postconditions: ex_ == ex and owns_ == true.
executor_work_guard(const executor_work_guard& other) noexcept;
Effects: Initializes ex_ with other.ex_. If other.owns_ == true, performs ex_.on_work_started().
Postconditions: ex_ == other.ex_ and owns_ == other.owns_.
executor_work_guard(executor_work_guard&& other) noexcept;
Effects: Initializes ex_ with std::move(other.ex_) and initializes owns_ with other.owns_, and sets other.owns_ to false.
Effects: If owns_ is true, performs ex_.on_work_finished().
executor_type get_executor() const noexcept;
Returns: ex_.
bool owns_work() const noexcept;
Returns: owns_.
Effects: If owns_ is true, performs ex_.on_work_finished().
Postconditions: owns_ == false.