|
Condy v1.1.0
C++ Asynchronous System Call Layer for Linux
|
Coroutine task that runs concurrently in the runtime. More...
#include <task.hpp>
Public Member Functions | |
| T | wait () |
| Wait synchronously for the task to complete and get the result. | |
| void | detach () noexcept |
| Detach the task to run independently. | |
| auto | operator co_await () noexcept |
| Await the task asynchronously. | |
Coroutine task that runs concurrently in the runtime.
| T | Return type of the coroutine. |
| Allocator | Allocator type used for memory management, default is void, which means use the default allocator. |
Task is a handle to a coroutine task that can be awaited or detached. The coroutine will be scheduled and executed in the associated runtime. User can await the task to get the result of the coroutine, or detach the task to let it run independently.
|
inlinenoexceptinherited |
Detach the task to run independently.
This function detaches the task, allowing it to run independently in the associated runtime. The caller will not be able to await the task or retrieve its result after detachment.
|
inlinenoexceptinherited |
Await the task asynchronously.
| Any | exception thrown inside the coroutine. |
This function allows the caller to await the completion of the coroutine associated with the task. It suspends the caller coroutine until the task completes, and then retrieves the result of the coroutine. If the coroutine throws an exception, it will be rethrown here.
|
inline |
Wait synchronously for the task to complete and get the result.
| Any | exception thrown inside the coroutine. |
This function blocks the current thread until the coroutine associated with the task completes. It then retrieves the result of the coroutine. If the coroutine throws an exception, it will be rethrown here.