#include <task_container.hpp>
Public Types | |
enum | wait_mode { All = 1, Any = 2 } |
The wait mode enum specifies the condition on which a wait() operation on a saga::task container returns. More... | |
Public Member Functions | |
task_container (void) | |
Creates a task_container. | |
~task_container (void) | |
Destroys a task_container. | |
void | run () |
Start all asynchronous operations in the container. | |
void | add_task (task t) |
Adds a task to a task_container. | |
void | remove_task (task t) |
Removes a task from a task_container. | |
std::vector< task > | list_tasks (void) const |
Lists the tasks in the task_container. | |
std::vector< task_base::state > | get_states (void) const |
Gets the states of all tasks in the task_container. | |
void | cancel (void) |
Cancels all the asynchronous operations in the container. | |
std::vector< task > | wait (wait_mode mode=All, float timeout=-1.0) |
Wait for one or more of the tasks to finish. |
Managing a large number of tasks can be tedious. The task_container class is designed to help in these situations, and to effectively handle a large number of asynchronous operations.
The wait mode enum specifies the condition on which a wait() operation on a saga::task container returns.
saga::task_container::task_container | ( | void | ) |
Creates a task_container.
saga::task_container::~task_container | ( | void | ) |
Destroys a task_container.
void saga::task_container::run | ( | void | ) |
Start all asynchronous operations in the container.
void saga::task_container::add_task | ( | task | t | ) |
Adds a task to a task_container.
task | Task to add to the task_container. |
void saga::task_container::remove_task | ( | task | t | ) |
std::vector< task > saga::task_container::list_tasks | ( | void | ) | const |
std::vector< task_base::state > saga::task_container::get_states | ( | void | ) | const |
Gets the states of all tasks in the task_container.
void saga::task_container::cancel | ( | void | ) |
Cancels all the asynchronous operations in the container.
timeout | Time for freeing resources. |