#include <Pt/System/Timer.h>
Awaitable for async one-shot timer delay. More...
Inherits BasicAwaiter< void >, and Connectable.
Public Member Functions | |
| AsyncWait (Timer &timer, std::size_t ms) | |
| Construct an awaitable for a one-shot timer delay. More... | |
| 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. | |
Protected Member Functions | |
| void | setReady () |
| Resumes the waiting coroutine. More... | |
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.
| timer | Reference to the Timer to delay. |
| ms | Duration in milliseconds. |
|
protectedinherited |
Call this when the asynchronous operation has completed. Typically connect a completion signal to this method.