#include <Pt/System/Timer.h>
Awaitable for async one-shot timer delay.
More...
Inherits BasicAwaiter< void >, and Connectable.
|
| | AsyncWait (Timer &timer, std::size_t ms) |
| | Construct an awaitable for a one-shot timer delay.
|
|
void | await_resume () |
| | Resumes the coroutine after the operation completed.
|
|
bool | await_ready () const |
| | Returns false so co_await always suspends.
|
|
template<typename P> |
| bool | await_suspend (std::coroutine_handle< P > h) |
| | Starts the operation and suspends the coroutine.
|
|
void | cancel () override |
| | Cancels the in-flight operation.
|
|
| void | setReady () |
| | Resumes the waiting coroutine.
|
Wraps the Timer's start() / stop() / timeout() async pattern into a C++20 awaitable for use with co_await. The timer is automatically started when the awaitable begins and stopped when it completes.
◆ AsyncWait()
| AsyncWait |
( |
Timer & | timer, |
|
|
std::size_t | ms ) |
- Parameters
-
| timer | Reference to the Timer to delay. |
| ms | Duration in milliseconds. |
◆ setReady()
Call this when the asynchronous operation has completed. Typically connect a completion signal to this method.