Namespaces
Variants

std::execution::run_loop::run

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 run() noexcept;
(since C++26)

Runs work queued in the run_loop on the calling thread.

Preconditions

The run_loop instance's state is either starting or finishing.

Effects

If the run_loop instance's state is starting, changes the state to running. Otherwise, leaves the state unchanged.

Then repeatedly removes the first queued operation state and executes it, as if by:

while (auto* op = pop-front())
    op->execute();

The internal pop-front operation blocks until either a work item is available, or the loop's count is 0 and its state is finishing. In the latter case, it changes the state to finished and causes run to return.

Example