Reference documentation for deal.II version GIT 982a52a150 2023-04-01 20:45:01+00:00

#include <deal.II/base/thread_management.h>

## Public Member Functions

std::size_t size () const

std::vector< RT > return_values ()

void join_all () const

## Detailed Description

A container for task objects. Allows to add new task objects and wait for them all together. The task objects need to have the same return value for the called function.

Note that the call to join_all() must be executed on the same thread as the calls that add subtasks. Otherwise, there might be a deadlock. In other words, a Task object should never passed on to another task for calling the join() method.

Definition at line 1649 of file thread_management.h.

## ◆ operator+=()

template<typename RT = void>
inline

Definition at line 1656 of file thread_management.h.

## ◆ size()

template<typename RT = void>
inline

Return how many tasks have been put into this group. This function does not distinguish how many of these tasks have already run and have finished, are still waiting to be scheduled to a CPU resource, or are currently running. Tasks that have been joined already are also still counted.

Definition at line 1671 of file thread_management.h.

## ◆ return_values()

template<typename RT = void>
inline

Return a vector of objects that contain the return values of the tasks contained in this group. This function can obviously only return once all tasks are completed.

The returned vector contains the returned values of tasks in the same order in which these tasks were added to the task group.

Note
This function only makes sense if RT is an actual data type, rather than void. If the TaskGroup stores tasks that have no return value, then you should simply call join_all(), which also waits for all tasks to finish.

Definition at line 1691 of file thread_management.h.

## ◆ join_all()

template<typename RT = void>
inline

Wait for all tasks in the collection to finish. It is not a problem if some of them have already been waited for, i.e. you may call this function more than once, and you can also add new task objects between subsequent calls to this function if you want.

Definition at line 1708 of file thread_management.h.

## Member Data Documentation

template<typename RT = void>
private

Definition at line 1718 of file thread_management.h.

The documentation for this class was generated from the following file: