Async++ unknown
Async (co_await/co_return) code for C++
|
A dispatcher that provides a way to schedule coroutines based on time. More...
#include <asyncpp/timer.h>
Public Member Functions | |
timer () | |
Construct a new timer. | |
timer (const timer &)=delete | |
timer & | operator= (const timer &)=delete |
void | push (std::function< void()> cbfn) override |
Push a callback to be executed in the timer thread. | |
void | schedule (std::function< void(bool)> cbfn, std::chrono::steady_clock::time_point timeout) |
Schedule a callback to be executed at a specific point in time. | |
void | schedule (std::function< void(bool)> cbfn, std::chrono::nanoseconds timeout) |
Schedule a callback to be executed after a certain duration expires. | |
template<typename Clock , typename Duration > | |
void | schedule (std::function< void(bool)> cbfn, std::chrono::time_point< Clock, Duration > timeout) |
Schedule a callback to be executed after a certain duration expires. | |
void | schedule (std::function< void(bool)> cbfn, std::chrono::steady_clock::time_point timeout, asyncpp::stop_token stoken) |
Schedule a callback to be executed at a specific point in time with a stop_token. | |
void | schedule (std::function< void(bool)> cbfn, std::chrono::nanoseconds timeout, asyncpp::stop_token stoken) |
Schedule a callback to be executed after a certain duration expires with a stop_token. | |
template<typename Clock , typename Duration > | |
void | schedule (std::function< void(bool)> cbfn, std::chrono::time_point< Clock, Duration > timeout, asyncpp::stop_token stoken) |
Schedule a callback to be executed after a certain duration expires with a stop_token. | |
auto | wait (std::chrono::steady_clock::time_point timeout) noexcept |
Get an awaitable that pauses the current coroutine until the specified time_point is reached. | |
template<typename Rep , typename Period > | |
auto | wait (std::chrono::duration< Rep, Period > timeout) noexcept |
Get an awaitable that pauses the current coroutine until the specified duration is elapsed. | |
template<typename Clock , typename Duration > | |
auto | wait (std::chrono::time_point< Clock, Duration > timeout) |
Get an awaitable that pauses the current coroutine until the specified duration is elapsed. | |
auto | wait (std::chrono::steady_clock::time_point timeout, asyncpp::stop_token stoken) noexcept |
Get an awaitable that pauses the current coroutine until the specified time_point is reached, allows cancellation. | |
template<typename Rep , typename Period > | |
auto | wait (std::chrono::duration< Rep, Period > timeout, asyncpp::stop_token stoken) noexcept |
Get an awaitable that pauses the current coroutine until the specified duration is elapsed, allows cancellation. | |
template<typename Clock , typename Duration > | |
auto | wait (std::chrono::time_point< Clock, Duration > timeout, asyncpp::stop_token stoken) |
Get an awaitable that pauses the current coroutine until the specified duration is elapsed, allows cancellation. | |
Static Public Member Functions | |
static timer & | get_default () |
Get a global timer instance. | |
Static Public Member Functions inherited from asyncpp::dispatcher | |
static dispatcher * | current () noexcept |
Additional Inherited Members | |
Static Protected Member Functions inherited from asyncpp::dispatcher | |
static dispatcher * | current (dispatcher *disp) |
Set the current dispatcher for this thread and reurns the current one. Implementers of dispatchers can use this to give convenient access to the current dispatcher, for example for yielding. A dispatcher usually calls this function once at the start of an event loop, before calling any callbacks and persists the return value. It then calls it again after calling all callbacks and restores the previously persisted value. This allows invoking a dispatcher loop from within another dispatcher. The end call is optional if the implementation can guarantee that the thread will terminate afterwards. | |
A dispatcher that provides a way to schedule coroutines based on time.
|
inlineoverridevirtual |
Push a callback to be executed in the timer thread.
cbfn | Callback to execute |
Implements asyncpp::dispatcher.
|
inline |
Schedule a callback to be executed after a certain duration expires.
cbfn | The callbackto execute |
timeout | The duration to wait before executing the callback |
|
inline |
Schedule a callback to be executed after a certain duration expires with a stop_token.
cbfn | The callbackto execute |
timeout | The duration to wait before executing the callback |
stoken | stop_token allowing to cancel the callback |
|
inline |
Schedule a callback to be executed at a specific point in time.
cbfn | The callback to execute |
timeout | The time_point at which the callback should get executed |
|
inline |
Schedule a callback to be executed at a specific point in time with a stop_token.
cbfn | The callback to execute |
timeout | The time_point at which the callback should get executed |
stoken | stop_token allowing to cancel the callback |
|
inline |
Schedule a callback to be executed after a certain duration expires.
cbfn | The callbackto execute |
timeout | The duration to wait before executing the callback |
|
inline |
Schedule a callback to be executed after a certain duration expires with a stop_token.
cbfn | The callbackto execute |
timeout | The duration to wait before executing the callback |
stoken | stop_token allowing to cancel the callback |
|
inlinenoexcept |
Get an awaitable that pauses the current coroutine until the specified duration is elapsed.
|
inlinenoexcept |
Get an awaitable that pauses the current coroutine until the specified duration is elapsed, allows cancellation.
timeout | The duration to wait for |
stoken | A stop_token that allows cancellation of the wait |
|
inlinenoexcept |
Get an awaitable that pauses the current coroutine until the specified time_point is reached.
|
inlinenoexcept |
Get an awaitable that pauses the current coroutine until the specified time_point is reached, allows cancellation.
timeout | The time_point to wait for |
stoken | A stop_token that allows cancellation of the wait |
|
inline |
Get an awaitable that pauses the current coroutine until the specified duration is elapsed.
|
inline |
Get an awaitable that pauses the current coroutine until the specified duration is elapsed, allows cancellation.
timeout | The duration to wait for |
stoken | A stop_token that allows cancellation of the wait |