|
ThreadSchedule 2.2.0
Modern C++ thread management library
|
Scoped task group that ensures all submitted work completes before the group is destroyed. More...
#include <task_group.hpp>
Public Member Functions | |
| task_group (Pool &pool) | |
| task_group (task_group const &)=delete | |
| auto | operator= (task_group const &) -> task_group &=delete |
| ~task_group () | |
| template<typename F> | |
| void | submit (F &&f) |
| Submit a void() callable to the group. | |
| void | wait () |
| Block until all submitted tasks complete. | |
| auto | pending () const -> size_t |
| Number of pending (not yet waited) tasks. | |
Scoped task group that ensures all submitted work completes before the group is destroyed.
wait(). All remaining tasks still run to completion.wait() if it has not been called already, ensuring that tasks never outlive the group. Note: if the destructor must wait for slow tasks, it will block.| Pool | Thread pool type (must support submit(Callable)). |
Definition at line 48 of file task_group.hpp.
|
inlineexplicit |
Definition at line 51 of file task_group.hpp.
Referenced by operator=(), and task_group().
|
delete |
References task_group().
|
inline |
Definition at line 56 of file task_group.hpp.
References wait().
|
delete |
References task_group().
|
inlinenodiscard |
Number of pending (not yet waited) tasks.
Definition at line 116 of file task_group.hpp.
|
inline |
Submit a void() callable to the group.
The returned future is tracked internally; you do not need to store it yourself.
Definition at line 74 of file task_group.hpp.
|
inline |
Block until all submitted tasks complete.
| Rethrows | the first exception from any task. All tasks are still waited on even if one throws. |
Definition at line 87 of file task_group.hpp.
Referenced by ~task_group().