asio C++ library

PrevUpHomeNext
basic_waitable_timer::expires_from_now (3 of 3 overloads)

(Deprecated: Use expires_after().) Set the timer's expiry time relative to now.

std::size_t expires_from_now(
    const duration & expiry_time,
    asio::error_code & ec);

This function sets the expiry time. Any pending asynchronous wait operations will be cancelled. The handler for each cancelled operation will be invoked with the asio::error::operation_aborted error code.

Parameters

expiry_time

The expiry time to be used for the timer.

ec

Set to indicate what error occurred, if any.

Return Value

The number of asynchronous operations that were cancelled.

Remarks

If the timer has already expired when expires_from_now() is called, then the handlers for asynchronous wait operations will:

These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.


PrevUpHomeNext