### Class

# Dex TaskGroup

unstable since: 1.2

#### Description [src]

    final class Dex.TaskGroup : GObject.TypeInstance
    {
      /* No available fields */
    }

A structured scope for related `DexFuture` instances.

A task group owns the futures added to it until the group is closed or cancelled. The group itself is also a `DexFuture`, so callers can await the scope to learn when all tracked futures have finished.

Use `dex_task_group_add()` to attach futures explicitly, or pass `NULL` to `dex_task_group_add()` after pushing a thread-default group with `dex_task_group_push_thread_default()`. Close the group with `dex_task_group_close()` once no more futures will be added.

Cancellation is stronger than ordinary discard-driven cleanup: calling `dex_task_group_cancel()` cancels all tracked children, including nested task groups, and completes the task group with a cancellation error. When `dex_task_group_close()` is used instead, the task group resolves only after every tracked future has resolved or rejected.

Developer note: always pair `dex_task_group_push_thread_default()` with `dex_task_group_pop_thread_default()` on the same thread, and prefer `dex_task_group_close()` over relying on finalization to finish work.

Available since: 1.2

#### Ancestors

- DexFuture
- DexObject

#### Constructors

###### dex_task_group_new

No description available.

#### Instance methods

###### dex_task_group_add

Adds `future` to `group`.

unstable since: 1.2

###### dex_task_group_cancel

No description available.

###### dex_task_group_close

Close the group to new tasks.

unstable since: 1.2

###### dex_task_group_pop_thread_default

No description available.

###### dex_task_group_push_thread_default

No description available.

##### Methods inherited from DexFuture (25)

Please see DexFuture for a full list of methods.

##### Methods inherited from DexObject (2)

###### dex_ref

Acquires a reference on the given object, and increases its reference count by one.

###### dex_unref

Releases a reference on the given object, and decreases its reference count by one.