commit f9053f38e5ca29c23d2328ed06293727cd1fe8d4 (tree)
parent 54eb03cbf61a5c5fdee29c0f45cca824e13d6af8
Author: Andrew Kelley <andrew@ziglang.org>
Date: Fri, 20 Feb 2026 16:57:48 -0800
std.Io.Select: add documentation
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/lib/std/Io.zig b/lib/std/Io.zig
@@ -1173,10 +1173,19 @@ pub fn checkCancel(io: Io) Cancelable!void {
return io.vtable.checkCancel(io.userdata);
}
+/// Executes tasks together, providing a mechanism to wait until one or more
+/// tasks complete. Similar to `Batch` but operates at the higher level task
+/// abstraction layer rather than lower level `Operation` abstraction layer.
+///
+/// The provided tagged union will be used as the return type of the await
+/// function. When calling async or concurrent, one specifies which union field
+/// the called function's result will be placed into upon completion.
pub fn Select(comptime U: type) type {
return struct {
io: Io,
group: Group,
+ /// The queue is never closed because there may be live resources
+ /// inserted into it which would otherwise leak.
queue: Queue(U),
const S = @This();