Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

concurrent

Public Function
std.Io.Group.concurrent
pub fn concurrent(g: *Group, io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) ConcurrentError!void

Equivalent to Io.concurrent, except the task is spawned in this Group instead of becoming associated with a Future.

The return type of function must be coercible to Cancelable!void. function returning error.Canceled does nothing because it is an cancelation propagation boundary.

Once this function is called, there are resources associated with the group. To release those resources, Group.await or Group.cancel must eventually be called.

Params

Errors

ConcurrencyUnavailable

May occur due to a temporary condition such as resource exhaustion, or to the Io implementation not supporting concurrency.

File

Io.zig:1378
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
    pub fn concurrent(g: *Group, io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) ConcurrentError!void {
        const Args = @TypeOf(args);
        const TypeErased = struct {
            fn start(context: *const anyopaque) void {
                const args_casted: *const Args = @ptrCast(@alignCast(context));
                _ = @as(Cancelable!void, @call(.auto, function, args_casted.*)) catch {};
            }
        };
        return io.vtable.groupConcurrent(io.userdata, g, @ptrCast(&args), .of(Args), TypeErased.start);
    }