fn Group(comptime ReturnType: type) type

ReturnType must be void or E!void TODO This API was created back with the old design of async/await, when calling any async function required an allocator. There is an ongoing experiment to transition all uses of this API to the simpler and more resource-aware std.event.Batch API. If the transition goes well, all usages of Group will be gone, and this API will be deleted.

Parameters

ReturnType: type,

Fields

frame_stack: Stack,
alloc_stack: AllocStack,
lock: Lock,
allocator: Allocator,

Types

Functions

fn add(self: *Self, handle: anyframe_type) error{OutOfMemory}!void

Add a frame to the group. Thread-safe.

fn addNode(self: *Self, node: *Stack.Node) void

Add a node to the group. Thread-safe. Cannot fail. node.data should be the fr…

Add a node to the group. Thread-safe. Cannot fail. node.data should be the frame handle to add to the group. The node’s memory should be in the function frame of the handle that is in the node, or somewhere guaranteed to live at least as long.

fn call(self: *Self, comptime func: anytype, args: anytype) error{OutOfMemory}!void

This is equivalent to adding a frame to the group but the memory of its frame is…

This is equivalent to adding a frame to the group but the memory of its frame is allocated by the group and freed by wait. func must be async and have return type ReturnType. Thread-safe.

fn init(allocator: Allocator) Self

No documentation provided.

fn wait(self: *Self) callconv(.Async) ReturnType

Wait for all the calls and promises of the group to complete. Thread-safe. Saf…

Wait for all the calls and promises of the group to complete. Thread-safe. Safe to call any number of times.