TaskGroup


Object Hierarchy:

Object hierarchy for TaskGroup

Description:

[ CCode ( type_id = "dex_task_group_get_type ()" ) ]
[ Version ( since = "1.2" ) ]
public sealed class TaskGroup : Future

A structured scope for related [class@Dex.

Future] instances.

A task group owns the futures added to it until the group is closed or cancelled. The group itself is also a [class@Dex.Future], so callers can await the scope to learn when all tracked futures have finished.

Use [method@Dex.TaskGroup.add] to attach futures explicitly, or pass `NULL` to [method@Dex.TaskGroup.add] after pushing a thread-default group with [method@Dex.TaskGroup.push_thread_default]. Close the group with [method@Dex.TaskGroup.close] once no more futures will be added.

Cancellation is stronger than ordinary discard-driven cleanup: calling [method@Dex.TaskGroup.cancel] cancels all tracked children, including nested task groups, and completes the task group with a cancellation error. When [method@Dex.TaskGroup.close] is used instead, the task group resolves only after every tracked future has resolved or rejected.

Developer note: always pair [method@Dex.TaskGroup.push_thread_default] with [method@Dex.TaskGroup.pop_thread_default] on the same thread, and prefer [method@Dex.TaskGroup.close] over relying on finalization to finish work.


Namespace: Dex
Package: libdex-1

Content:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class Dex.Object