asio C++ library

PrevUpHomeNext

io_context::run_one_for

Run the io_context object's event processing loop for a specified duration to execute at most one handler.

template<
    typename Rep,
    typename Period>
std::size_t run_one_for(
    const chrono::duration< Rep, Period > & rel_time);

The run_one_for() function blocks until one handler has been dispatched, until the io_context has been stopped, or until the specified duration has elapsed.

Parameters

rel_time

The duration for which the call may block.

Return Value

The number of handlers that were executed.


PrevUpHomeNext