Squid::Tasks 1.0.0
C++14 coroutine-based task library for games
|
Manager that runs and resumes a collection of tasks. More...
#include <TaskManager.h>
Public Member Functions | |
template<typename tRet > | |
TaskHandle< tRet > | Run (Task< tRet > &&in_task) |
Destructor (disables copy/move construction + assignment) More... | |
template<typename tRet > | |
WeakTaskHandle | RunManaged (Task< tRet > &&in_task) |
Run a managed task. More... | |
void | RunWeakTask (WeakTask &&in_task) |
Run a weak task. More... | |
void | KillAllTasks () |
Call Task::Kill() on all tasks (managed + unmanaged) | |
Task | StopAllTasks () |
Issue a stop request using Task::RequestStop() on all active tasks (managed and unmanaged) More... | |
void | Update () |
Call Task::Resume() on all active tasks exactly once (managed + unmanaged) | |
std::string | GetDebugString (std::optional< TaskDebugStackFormatter > in_formatter={}) const |
Get a debug string containing a list of all active tasks. | |
Manager that runs and resumes a collection of tasks.
|
inline |
Destructor (disables copy/move construction + assignment)
Run an unmanaged task
Run() return a TaskHandle<> that holds a strong reference to the task. If there are ever no strong references remaining to an unmanaged task, it will immediately be killed and removed from the manager.
|
inline |
Run a managed task.
RunManaged() return a WeakTaskHandle, meaning it can be used to run a "fire-and-forget" background task in situations where it is not necessary to observe or control task lifetime.
|
inline |
Run a weak task.
RunWeakTask() runs a WeakTask. The caller is assumed to have already created a strong TaskHandle<> that references the WeakTask, thus keeping it from being killed. When the last strong reference to the WeakTask is destroyed, the task will immediately be killed and removed from the manager.
|
inline |
Issue a stop request using Task::RequestStop() on all active tasks (managed and unmanaged)
Returns a new awaiter task that will wait until all those tasks have all terminated.