boost::corosio::timer
An asynchronous timer for coroutine I/O.
Synopsis
Declared in <boost/corosio/timer.hpp>
class timer
: public io_timer
Description
This class provides asynchronous timer operations that return awaitable types. The timer can be used to schedule operations to occur after a specified duration or at a specific time point.
Multiple coroutines may wait concurrently on the same timer. When the timer expires, all waiters complete with success. When the timer is cancelled, all waiters complete with an error that compares equal to capy::cond::canceled.
Each timer operation participates in the affine awaitable protocol, ensuring coroutines resume on the correct executor.
Semantics
Timers are not backed by per‐timer kernel objects. The io_context's timer service keeps a process‐side min‐heap of pending expirations; the nearest expiry drives the reactor's poll timeout, and expirations are processed in the run loop.
Types
Name |
Description |
RAII wrapper for I/O object implementation lifetime. |
|
Backend interface for timer wait operations. |
|
Service interface for I/O object lifecycle management. |
Type Aliases
Name |
Description |
The clock type used for time operations. |
|
The duration type for relative expiry times. |
|
Alias for backward compatibility. |
|
The time point type for absolute expiry times. |
Member Functions
Name |
Description |
|
Constructors |
|
Destructor. |
|
Move assignment operator. |
Cancel all pending asynchronous wait operations. |
|
Cancel one pending asynchronous wait operation. |
|
Return the execution context. |
|
Set the timer's expiry time relative to now. |
|
Set the timer's expiry time as an absolute time. |
|
Return the timer's expiry time as an absolute time. |
|
Wait for the timer to expire. |
Protected Member Functions
Name |
Description |
|
Construct from |
|
Assignment operators |
|
Dispatch cancel to the concrete implementation. |
Return the underlying implementation. |
Protected Static Member Functions
Name |
Description |
Create a handle bound to a service found in the context. |
Derived Classes
Name |
Description |
An asynchronous timer with devirtualized wait operations. |
Created with MrDocs