|
ThreadSchedule 3.0.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 > | |
| auto | 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. Tasks submitted recursively by a task already running in this group are executed inline. This preserves progress when every pool worker is occupied by a parent task waiting for its grouped children.| Pool | Thread pool type (must support submit(Callable)). |
Definition at line 82 of file task_group.hpp.
|
inlineexplicit |
Definition at line 89 of file task_group.hpp.
|
delete |
|
inline |
Definition at line 94 of file task_group.hpp.
References threadschedule::advanced::task_group< Pool >::wait().
|
delete |
|
inline |
Number of pending (not yet waited) tasks.
Definition at line 225 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 113 of file task_group.hpp.
References threadschedule::detail::task_group_is_current_worker().
|
inline |
Block until all submitted tasks complete.
Tasks submitted to this group by a task currently being waited on are included in the same wait operation.
| Rethrows | the first exception from any task. All tasks are still waited on even if one throws. |
Definition at line 187 of file task_group.hpp.
Referenced by threadschedule::advanced::task_group< Pool >::~task_group().