Namespaces
Variants

std::execution::run_loop::finish

From cppreference.com
 
 
Execution control library
Execution concepts
Execution components
Execution contexts
Execution domains
Forward progress guarantee
Environments
    
    
    
Queries
Completion signatures
Sender adaptor closures
Coroutine utility
 
 
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