Task Groups

The following table provides additional information on the members of this template class.
Member Description
task_group()

Constructs an empty task group.

~task_group()

Requires: Method wait must be called before destroying a task_group, otherwise the destructor throws an exception.

template<typename Func> void run( const Func& f )

Spawn a task that computes f() and return immediately.

template<typename Func> void run ( task_handle<Func>& handle );

Spawn a task that computes handle() and return immediately.

template<typename Func> void run_and_wait( const Func& f )

Equivalent to {run(f); wait();}, but guarantees that f runs on the current thread.

Note

Template method run_and_wait is intended to be more efficient than separate calls to run and wait.

template<typename Func> void run _and_wait( task_handle<Func>& handle );

Equivalent to {run(handle); wait();}, but guarantees that handle() runs on the current thread.

Note

Template method run_and_wait is intended to be more efficient than separate calls to run and wait.

task_group_status wait()

Wait for all tasks in the group to complete or be cancelled.

Returns: True if this task group is cancelling its tasks.

bool is_canceling()

Returns: True if this task group is cancelling its tasks.

void cancel()

Cancel all tasks in this task_group.

For more complete information about compiler optimizations, see our Optimization Notice.