std::execution::run_loop::finish
void finish() noexcept; | (since C++26) |
Requests the run_loop to finish.
Preconditions
The run_loop instance's state is either starting or running.
Effects
Changes the run_loop instance's state to finishing.
If a thread is blocked in run waiting for work, finish lets that call return once the queue is empty.
Synchronization
finish synchronizes with the internal pop-front operation that returns nullptr to run.
Notes
Calling finish does not discard already queued work. A run call continues to execute queued operation states until the queue becomes empty, then returns.
It is valid to call finish before run. In that case, a later call to run observes the finishing state and returns once it sees the empty queue.
Example
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/execution/run_loop/finish