Standard C++20 coroutine-based Task implementation (no external deps)
More...
#include <coroutine_utils.h>
template<typename T>
class agents::Task< T >
Standard C++20 coroutine-based Task implementation (no external deps)
- Template Parameters
-
T | The result type of the task |
- Examples
- coroutine_example.cpp, multimodal_example.cpp, robotics_object_detection_demo.cpp, simple_agent.cpp, and streaming_chat.cpp.
◆ Task() [1/2]
Constructor with handle.
- Parameters
-
◆ Task() [2/2]
Constructor with other Task.
- Parameters
-
other | The other Task to use |
◆ await_ready()
Await ready for Task.
- Returns
- Whether the Task is ready
◆ await_resume()
Await resume for Task.
- Returns
- The awaited result if
T
is not void
.
◆ await_suspend()
template<typename T>
void agents::Task< T >::await_suspend |
( |
std::coroutine_handle<> | awaiting | ) |
|
|
inline |
Await suspend for Task.
- Parameters
-
awaiting | The awaiting coroutine handle |
◆ get_sync()
Synchronously wait and get the value (used by blockingWait)
- Returns
- The result of the Task
◆ operator=()
Operator= for Task.
- Parameters
-
other | The other Task to use |
- Returns
- The Task
◆ valid()
Valid for Task.
- Returns
- Whether the Task is valid