13 Asynchronous model [async]

13.16 Class template executor_work_guard [async.exec.work.guard]

13.16.1 executor_work_guard members [async.exec.work.guard.members]

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.

~executor_work_guard();

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_.

void reset() noexcept;

Effects: If owns_ is true, performs ex_.on_work_finished().

Postconditions: owns_ == false.