carb::tasking::TaskGroup¶
Defined in carb/tasking/TaskingUtils.h
-
class
carb::tasking
::
TaskGroup
¶ TaskGroup is a small and fast counter for tasks.
TaskGroup blocks when tasks have “entered” the TaskGroup. It becomes signaled when all tasks have left the TaskGroup.
Public Functions
-
inline
~TaskGroup
()¶ TaskGroup destrutor.
Warning
It is an error to destroy a TaskGroup that is not empty. Doing so can result in memory corruption.
-
inline bool
empty
() const¶ Returns (with high probability) whether the TaskGroup is empty.
As TaskGroup atomically tracks tasks, this function may return an incorrect value as another task may have entered or left the TaskGroup before the return value could be processed.
- Returns
true
if there is high probability that the TaskGroup is empty (signaled);false
otherwise.
-
inline bool
try_wait
() const¶ Returns
true
if the TaskGroup is empty (signaled) with high probability.- Returns
true
if there is high probability that the TaskGroup is empty (signaled);false
otherwise.
-
template<class
Rep
, classPeriod
>
inline booltry_wait_for
(std::chrono::duration<Rep, Period> dur)¶ Blocks the calling thread or task until the TaskGroup becomes empty or the given duration elapses.
- Parameters
dur – The duration to wait for.
- Returns
true
if the TaskGroup has become empty;false
if the duration elapses.
-
template<class
Clock
, classDuration
>
inline booltry_wait_until
(std::chrono::time_point<Clock, Duration> when)¶ Blocks the calling thread or task until the TaskGroup becomes empty or the given time is reached.
- Parameters
when – The time to wait until.
- Returns
true
if the TaskGroup has become empty;false
if the given time is reached.
-
inline