HikoGUI
Select Version: ⚠️ This documents the main development branch of HikoGUI. It might differ from release versions.
A low latency retained GUI
|
#include <hikogui/dispatch/task.hpp>
Data Structures | |
struct | promise_type |
Public Types | |
using | value_type = T |
using | notifier_type = notifier<void(value_type)> |
using | callback_type = notifier_type::callback_type |
using | handle_type = std::coroutine_handle<promise_type> |
Public Member Functions | |
task (handle_type coroutine) noexcept | |
task (task const &)=delete | |
task & | operator= (task const &)=delete |
task (task &&other) noexcept | |
task & | operator= (task &&other) noexcept |
bool | started () const noexcept |
Check if the co-routine was started. | |
bool | running () const noexcept |
Check if the co-routine is running. | |
bool | done () const noexcept |
Check if the co-routine has completed. | |
value_type const & | value () const |
Get the return value returned from co_return. | |
value_type const & | operator* () const |
Get the return value returned from co_return. | |
template<forward_of< void(value_type)> Func> | |
callback< void(value_type)> | subscribe (Func &&func, callback_flags flags=callback_flags::synchronous) noexcept |
Subscribe a callback for when the co-routine is completed. | |
auto | operator co_await () const noexcept |
Create an awaiter that can await on this task. | |
A task.
This implements a asynchronous co-routine task.
T | The type returned by co_return. |
DestroyFrame | Destroy the coroutine frame when task goes out of scope. |
|
inlinenoexcept |
Check if the co-routine has completed.
|
inlinenoexcept |
Create an awaiter that can await on this task.
|
inline |
Get the return value returned from co_return.
The | exception thrown from the co-routine. |
|
inlinenoexcept |
Check if the co-routine is running.
|
inlinenoexcept |
Check if the co-routine was started.
|
inlinenoexcept |
Subscribe a callback for when the co-routine is completed.
flags | The callback flags used to be passed to the notifier. |
callback | The callback to call when the co-routine executed co_return. If co_return has a non-void expression then the callback must accept the expression as an argument. |
|
inline |
Get the return value returned from co_return.
The | exception thrown from the co-routine. |